Skip to content

Instantly share code, notes, and snippets.

@joaofx
Last active April 29, 2020 18:20
Show Gist options
  • Save joaofx/d47b010df02e5022ab047266edbfdf8b to your computer and use it in GitHub Desktop.
Save joaofx/d47b010df02e5022ab047266edbfdf8b to your computer and use it in GitHub Desktop.
List of useful git commands

GitFlow And Useful Git Commands

Did you forget to create a new branch, and made all your changes in the master/wrong branch?

git switch -c "new-branch"

New Feature

Finish Feature

  • Merge FEATURE_BRANCH to MASTER squashing
git checkout master
git merge --no-commit --squash FEATURE_BRANCH
  • Solve eventual conflicts.
  • Commit merge to master
git commit -m ""
  • Remove FEATURE_BRANCH local and remote
git branch -d FEATURE_BRANCH
git push origin --delete FEATURE_BRANCH
  • Push to origin
git push

Commands

Discard changes in local branch

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