Skip to content

Instantly share code, notes, and snippets.

@ipatalas
Last active May 19, 2021 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipatalas/39c0f78d5ddfddae2c828170eaae427e to your computer and use it in GitHub Desktop.
Save ipatalas/39c0f78d5ddfddae2c828170eaae427e to your computer and use it in GitHub Desktop.
Git helpers
[alias]
# clean all local branches that no longer have an existing remote
clean-local = "!git remote prune origin && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs -r git branch -D"
# show all ignored (--assume-unchanged) files
ignored = "!git ls-files -v | grep '^[[:lower:]]'"
ignore = update-index --assume-unchanged
unignore = update-index --no-assume-unchanged
s = switch
new-feature = "!f() { git checkout -b feature/$1 --no-track origin/develop; }; f"
new-bugfix = "!f() { git checkout -b bugfix/$1 --no-track origin/develop; }; f"
ci = commit -m
[pager]
log = false
show = false
config = false
:: Refresh forked repo
git remote add upstream <original_repo>
git fetch upstream
git merge upstream/master
:: Create branch from other branch
git checkout -b <new_branch> --no-track origin/<original_branch>
:: Find a deleted file
git log --diff-filter=D --summary | grep delete
git log --all -- FILEPATH
git show COMMIT_ID -- FILE_PATH
; **git-specific
#If WinActive("cmd") or WinActive("MINGW64")
::gc::git commit
::gch::git checkout
::gr::git rebase -i
::grc::git rebase --continue
::gra::git rebase --abort
::grh::git reset --hard
::gb::git branch
::gst::git stash
::ga::git add -p
::gai::git add -i
::gm::git merge origin/
::gignore::git update-index --assume-unchanged
::gunignore::git update-index --no-assume-unchanged
::gnb::git checkout -b --no-track origin/development{left 30}
#If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment