Skip to content

Instantly share code, notes, and snippets.

@regexyl
Last active March 31, 2022 01:42
Show Gist options
  • Save regexyl/5b64a4802678294a4de266c1588b1d26 to your computer and use it in GitHub Desktop.
Save regexyl/5b64a4802678294a4de266c1588b1d26 to your computer and use it in GitHub Desktop.

Git Commands

Commit

git commit --allow-empty -m "trigger build" # Commit no new changes to trigger build
Amend to last commit

You should never amend public commits (i.e. already pushed to a public reop).

# --no-edit: makes an amendment without changing the commit message
git add *FILE_TO_ADD* && git commit --amend --no-edit

Push

git push -u origin master # -u is the same as --set-upstream

Branch

Moves all your changes to new-branch

git switch -c "new-branch" # If you forget to checkout on a new branch before making commits:

Remote

git remote -v # Check git remote
git remote remove origin # Remove remote branch with origin alias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment