Skip to content

Instantly share code, notes, and snippets.

@abdurrahman
Last active October 12, 2020 14:52
Show Gist options
  • Save abdurrahman/b9f84fdf3cabe3e2859425e6e2ed826c to your computer and use it in GitHub Desktop.
Save abdurrahman/b9f84fdf3cabe3e2859425e6e2ed826c to your computer and use it in GitHub Desktop.
Time savior git commands.

How to undo latest commmit back

git reset --soft HEAD~1

It undoes the most recent commit whilst keeping the changes made in that commit to staging.

Merge development into master

git checkout master 
git merge development
git push -u origin master

How to list branches that contain a given commit?

git branch -r --contains <commit>

Delete all local branches that are already merged into master

If you want to delete all local branches that are already merged into master, you can use the following command

git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d

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