Mnemonics are called mnemonics because they are hard to memorize.
The following is more or less just a reminder for myself. A good online reference is Git Reference for the basics.
To add one file (assuming /bin/sh and common GIT naming):
git add a_file.c git commit -m "Added a_file.c with the miraculous function one_file()"
To add more than one file, commit them all and give all of them the same comment. I used this to commit the three files necessary for the most basic build.
git add tommath.h tommath_class.h makefile git commit -m "Addition of a_file.c with function one_file()"
Push all of them to remote GIT repository
git fetch upstream git push -v origin master
git fetch upstream checks the original for intermediate changes that might
ruin your day make what you did obsoleteintersperse with what you have done. If something happened (not in libtommath, last change is a long time ago) you need to do
git merge upstream/master where
master is the main branch of
upstream which is the remote original one. The full command merges that branch with your local branch. Uhm…you can find out the aliases (they are not fixed, the above are just the commonly used ones!) with
git remote -v . Here are my results:
czurnieden@home:~/GITHUB/libtommath$ git remote -v origin https://github.com/czurnieden/libtommath.git (fetch) origin https://github.com/czurnieden/libtommath.git (push) upstream https://github.com/libtom/libtommath.git (fetch) upstream https://github.com/libtom/libtommath.git (push)
To find out what happened in the meantime before fetching
git log upstream/master ^master
If unsure which branch you are hacking right now
Say:”Ooops!” and change to branch
testing which you have made with
git branch testing
git checkout testing
Check if you haven’t forgoten any file to commit:
git diff-tree --no-commit-id --name-only HEAD~20..HEAD
The number 20 is the maximum number
git checks, so if you commited more, increment that number.