Know that the Git book probably talks about
your problem, and you can append -h
or --help
to any git
command to
view either a short or in-depth help message.
Clone repository so you have main working repository (repo) on your computer. You only do this once!
git clone https://github.com/BoofPC/ZorCK2016.git
Create your own branch to work on and switch to it using git checkout
:
git branch $MY_BRANCH
git checkout $MY_BRANCH
Do work editing the code/adding cool stuff. When done with a fair bit of work and testing of your code, add and commit your work on your branch (don't forget the message):
git status # figure out what you've changed
git add $FILE_A $FILE_B $FILE_C # add the files you changed and want to commit
# (you can use git add -A to add everything, but be careful)
git commit -m "Short description of work"
# if you want to say more, use git commit and write the longer changes on
# extra lines (the comments in the message in the editor should guide you)
To merge your work into the master:
git checkout master
git pull --ff-only
git checkout $MY_BRANCH
git rebase master # if you need to fix merge conflicts, let me know & I'll help
git checkout master
git pull --ff-only # if anything changed in master, restart this step
git merge $MY_BRANCH # perform a final fast-forward merge of your branch with master
Your branch is now merged into master
; you just need to push so everyone
can pull your changes.
git push origin master
Finally, if all that worked, delete your feature branch:
git branch -d $MY_BRANCH
Your branch will be deleted if properly merged.
Repeat steps 2-4 as necessary. You can check on the commit history of a branch
using git log $BRANCH
, or no $BRANCH
for the current branch.
Credit to bb010g for writing this tutorial.