Sunday, August 7, 2016

Basic Terminal Commands for GitHub Branch and Merge, in one place:

You can easily Google for websites describing details of how "git branch" and "git merge" work, but I thought it'd be useful to have their basic commands in one page for reference.  If you want fuller descriptions, goto Google(By the way, "commandline" = "Terminal" on Macs.)

First navigate folders using cd and check what files are there using ls before typing the following commands.  You'll be typing each command one at a time (the comments in blue that start with "#" are just for short explanations--they don't perform anything in Terminal).   

In the commands below, "nameOfBranch" is the name of the branch (a copy of files "branching" temporarily from the master copy).  This would be the name of the branch that you want to create, edit, remotely "save", merge with the original master copy, and finally get rid of:

# create branch & use its files
git branch nameOfBranch
git checkout nameOfBranch

# make changes to its files on your computer…

# transfer files to remote repository, with a message describing the “save”
git add --all
git commit -m “message”
git push origin nameOfBranch

# merge changes into master (by first moving to master branch copy)
git checkout master
git merge nameOfBranch

git push origin master

# get rid of old branch
git branch -D nameOfBranch

I've backed up these instructions (if you prefer a file) at: 
github.com/hchiam/code7/blob/master/gitBranchMerge.txt

More examples of Terminal/Command-Line code for GitHub:  (ctrl+f "essential commands")
http://hchiam.blogspot.ca/2016/06/the-code-7-project-problem-1.html


_________________________

LINKS TO OTHER STUFF: 

Favourites
Programming
Original Art
Games

Chinese Learning Projects:
 - Book
 - HSK 1
 - HSK 5
 - Homonyms Mnemonics