23 September 2014

Learning More Git

A quick recap on the last post to refresh memory. We'll save more details on git for the next post.

My master repository is going to use the alias "upstream" and my fork of it will use the alias "origin". I will be doing work in the develop branch, and I will be using the origin https://github.com/karlmortensen/learn-git

Command Result
git init Make local machine current directory into a git repository.
git clone URL Clone my fork of this repo from GitHub down to my local machine
git status Show which files are modified and which are staged to commit
git status -s Shows simplified view of git status
git checkout -b new_branch Creates new_branch and sets it to be the branch I am working on
git add somefile.txt Adds somefile.txt to the staged to commit list
git diff updatedfile.txt Shows diff between the file on local machine and committed version
git branch Show the branch I'm working on right now
git commit -m "My message here" Commits changes to the branch I'm working on right now
git push origin master Push committed changes to the origin repo, master branch
git fetch upstream Grab the lastest-greatest from the upstream master
git merge upstream/master Merge the fetched latest-greatest into my local clone