Skip to content

Instantly share code, notes, and snippets.

@danstepanov
Last active April 18, 2023 19:58
Show Gist options
  • Save danstepanov/33cb3285877779802da3eb2ac50b660a to your computer and use it in GitHub Desktop.
Save danstepanov/33cb3285877779802da3eb2ac50b660a to your computer and use it in GitHub Desktop.
Useful git aliases
[alias]
co = checkout
cob = checkout -b
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cm = !git add -A && git commit -m
bclean = "!f() { git branch --merged ${1-main} | grep -v "${1-main}$" | xargs git branch -d; }; f"
bdone = "!f() { git co ${1-main} && git up && git bclean ${1-main}; }; f"
po = push origin
st = status
undolastcommit = reset HEAD~
reverttomain = !git fetch origin && git reset --hard origin/main
@danstepanov
Copy link
Author

danstepanov commented Apr 18, 2023

to configure gitconfig to use vscode, you can run

git config --global core.editor "code --wait"

then you can access the gitconfig by running

git config --global --edit

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment