Some Git Tips
Mostly so I remember them myself.
Tags
Tagging certain commits comes in handy when wanting to find back for example a certain release or some such. The tagging part is easy.
# To tag the current HEAD
$ git tag -a v1.0
# To tag an older commit
$ git tag -a v1.0 THECHECKSUM
# For example
$ git log --pretty=oneline
d1a818878187ae8a01239821786ba65aba1ec5e1 math stat - handwritten tem p24
70a59dea8a11c93267996cce31f269287749440d math stat handwritten, one parameter exp family
$ git tag -a v1.0 70a59dea8a11c93267996cce31f269287749440d
The part I missed is that tags are not automatically pushed to your remote. For
that you need to add --tags
to your push command, this will push all your
local tags to the remote.
$ git push --tags
HTTPS Authentication
I have been using the HTTPS link to use my GitHub repo on my laptop, but it kept on asking me for my password on every single pull and push. Git can help you with that since version 1.7.10, by using the credential helper.
# Turn it on
$ git config --global credential.helper cache
# Set a timeout in seconds (default is 15 minutes)
$ git config --global credential.helper 'cache --timeout=1800'