Skip to content

Instantly share code, notes, and snippets.

@tforster
Last active October 19, 2024 19:38
Show Gist options
  • Save tforster/d112d9022707de5d5e7a9614bc6c4716 to your computer and use it in GitHub Desktop.
Save tforster/d112d9022707de5d5e7a9614bc6c4716 to your computer and use it in GitHub Desktop.
Useful git command sequences

Some useful git command sequences

Table of Contents

Reset all changes after last commit in git

To reset all changes after the last commit in git, you can use the following commands:

git reset HEAD --hard
git clean -fd

Rename a branch in both local and remote

git checkout branch_to_rename
git branch -m new_name
git push -u origin :old_name new_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment