T-6 until assessment00 window closes

Git Immersion – 24 to end

  • Major changes – Create a branch
    • Create it: git checkout -b branchname (-b is just short for branch )
    • after adding a few commits, switching back to master is just git checkout master (working directory will be updated), and switching back is just git checkout branchname
    • seing a branch – shows up with the --graph option (already shortcutted in .gitconfig in $HOME), branch appears after common ancestor
  • Merge two branches – good for branches in the public repository
    • Without existing conflicts: git merge branch_to_merge_with 
    • With conflicts, the same command will print a merge failed error, and then alter the conflicting file in a way that prints both versions of it, separated by a ============= line, and you will have to manually modify the file and resolve the conflict, then add it and commit it
    • Advanced merging techniques exist
    • A fast forward merge will result if you are merging from a direct ancestor of who you are merging with
  • Rebasing – good for short-lived local branches
    • while in the branch that you want to add into, git rebase branch_to_import
    • this will keep a linear chain of commits, but it rewrites commit history, so don’t use it if you are sharing branches with others
  • Multiple repositories
    • git clone name name_of_clone to clone a copy of the repo in the same directory
    • git remote shows other repositories, get info on them via git remote show remote_name 
      • from git branch we see that a cloned repository only has one branch, via git branch -a we see that there are additional branches on remote repositories
    • git fetch will show commits from the remote origin repo to be listed in git hist --all without merging them with local branches
      • the tag origin/HEAD will signify where the head is in the remote branch
    • merging a remote repository with a local one is, predictably, done via git merge origin/master
    • pull = fetch && merge origin/master
      • with remote branches: after a remote add and a branch --track
      • git pull receiver_tag what_is_pulled
    • Tracking a remote branch git branch --track local_branch_name branch_to_track , now you’ll be able to see it via git branch -a
    • pushing – git push who_is_recieving_the_push who_is_being_pushed (should be added as remote first) 
  • Bare repositories – great for sharing
    • git clone --bare clone_me name_of_clone.git so that the whatever.git file will have no working directory
    • to add to a local repo from a remote bare one: git remote add new_repo_name ../remote_source_directory
  • Future topics for study: Cross OS Line Endings, SSH Setup, Remote Branch Management, Workflows

Rails Tutorial

Continued from… After rails new app_name and specifying gems in the application root’s Gemfile, and  installing them via Bundler (bundle update && bundle install)

  • rails server command makes the app visible on local host port 3000
  • Started using git with the app
    • .gitignore file is created by rails automatically in the app’s root directory, it contains listings of directories with files that change frequently in unimportant ways (log files).
      • we can add some more directories which specify vim+emacs swap files, documentation files, and the Finder’s .DS_Store files
      • btw, git adds files to commit recursively
      • before continuing – learn a little more about GitHub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s