Skip to content

Instantly share code, notes, and snippets.

@h3nr1ke
Last active April 3, 2018 15:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h3nr1ke/054a5345590755eae677831f78dc91a8 to your computer and use it in GitHub Desktop.
Save h3nr1ke/054a5345590755eae677831f78dc91a8 to your computer and use it in GitHub Desktop.
Useful git tips
#--- good resource
http://gitready.com/
#--- When you want to commit files that used to be ignored or vice versa
git rm -r --cached .
git add .
git commit -m "Commit follows the .gitignore again"
#--- Get the remote URL from a repository
git config --get remote.origin.url
#--- Save password
git config credential.helper store
#--- Create a tag
git tag -a v0.1 -m 'Version 0.1 of my software'
#--- Remove a tag
git tag -d <TAG_NAME>
git push origin :refs/tags/<TAG_NAME>
#--- Read local and remote branchs
git branch -a #local and remote
git branch -r #only remotes
#--- Push local branch
git push -u origin <branchname>
#--- change user name and email
git config --global user.name "Your Name"
git config --global user.email "email@here.com"
#--- get all commits from a specific file
git log --follow filename
#--- remove a local branch
git branch -d branch_name
#-- list all branchs
git branch -a
#-- list only remote brnachs
git branch -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment