Some basic commands. Ignore if you are already familiar with these stuffs.
git init $PATH
Path needs to be empty or could have source files, except a .git folder.
git add $filename
Adds file to git repository
git rm $filename
Removes file from git repository
In case remote git repository exists, use the following to update.
git remote add $name $url
Add's a remote url to your .git/config lets you start off collabarative development.
git fetch $branchname
Will fetch content from remote repository.
Never create a branch for every code push or commit that you do. Use tagging like below.
Create tag's if necessary, create tags for important commits like a merge from upstream contiki. Or deliver some important bug fix to a protocol stack.
Creates a tag with $tagname
git tag $tagname
Delets a tag with $tagname
git tag -d $tagname
Always, work on one developmental "branch" uproach. No need of pushing any changes of this branch to 'master'. Though it is "ok" to have them as branches along with master in the github repo.
git checkout -b $branchname
Checkouts a new branch with $branchname.
Push/Pull code. If you are working on collabarative devel, and people could access your branch always do a fetch before you push code onto the git remote repository. i.e
git fetch origin
'Origin' would fetch code from a branch with name origin/$branchname. Then it means someone has added some changes to your branch. Then you would have to merge these changes before pushing to avoid any rejects.
i.e
git push . origin:origin/$branchname git merge origin/$branchname --no-ff --no-squash --no-commit.
The above command, would not commit the code. Have a look before commiting and pushing.
Once everything is fine.
git push $branchname.
For a fetch & merge with no real checks.
git pull origin
On the checked out branch, the above command would be useful. But be careful always.
git status
Gives you the status of current local git repository.
git stash
Used to move to the commit before the working copy, really useful.
git rename $branchname
Used to rename a git branch.
git commit -s -m "Commit message"
-s is used to signing Patches.
-m says whatever follows after this option is the commit message.
Once you've worked and commited your code on local repository. Use this command to create a patch for the HEAD commit hash of your local repository
git format-patch -n HEAD^
This would create a patch file on the path where run the command.
git send-email $PATH_FILE
Could be used to send the patch file over email to the maintainer for review, and merging.
The below is just a sample .gitconfig file from my filesystem. There are other fancy stuffs, I've kept it simple.
===== [user] name = Your Name email = your_email_id@host [color] true [diff] color = true [status] color = true [core] editor = emacs [sendemail] smtpEncryption = tls smtpServer = your_smtp_server smtpUser = your_smtp_id smtpServerPort = 25 bcc = your_email_id [push] default = simple
For anything else, have a look at git manual. Or ping me just in case.