Skip to content

Instantly share code, notes, and snippets.

@ethauvin
Last active January 19, 2022 23:27
Show Gist options
  • Save ethauvin/50eea318470f44d97d31453470ba8b80 to your computer and use it in GitHub Desktop.
Save ethauvin/50eea318470f44d97d31453470ba8b80 to your computer and use it in GitHub Desktop.
git snippets

A collection of Git snippets.

git update-index --chmod=+x *.sh *.bat
git diff --cached <file> ...
git ls -i --grep='<given-text>'
git check-ignore *
git whatchanged --since='2 weeks ago'
git show -2
git log -2
#CREATE
git checkout -b newbranch
#MERGE
git ss
git cm "If necessary"; git pa
git checkout master
git ss
git cm "If necessary"; git pa
git checkout newbranch
# git merge --strategy=ours master
git merge -Xours master
git checkout master
git merge --no-ff newbranch
#LIST
git branch --merged
git branch -r --merged
#DELETE
git branch -d newbranch
git push all --delete newbranch
git submodule foreach git pull
git tag -a 1.0.0 -m "Version 1.0.0"
# Delete local tag
git tag -d tagname
# Delete remote tag
git push --delete all tagname
git remote add upstream [email protected]:repo/repo.git
git fetch upstream
git checkout master
git merge upstream/master
# OR
git fup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment