Skip to content

Instantly share code, notes, and snippets.

@cjfswd
Last active May 25, 2022 17:05
Show Gist options
  • Save cjfswd/78912f71ede8b2b89eb0b11fa5d105d7 to your computer and use it in GitHub Desktop.
Save cjfswd/78912f71ede8b2b89eb0b11fa5d105d7 to your computer and use it in GitHub Desktop.
useful git snippets.

discard all unstaged files
git restore .

undo git add
git reset .

add current staged changes to the last commit
git commit --amend --no-edit

copy commit by id
git cherry-pick 'commitID'

sync with remote
git fetch --prune

interactive rebase in entire branch
git rebase -i --root 'branchName'

push to all branchs
git push -all 'remoteName'

ignore case sensitivity
git config core.ignorecase true

get remote url
git remote show origin

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