Git common commands

git rebase <branch_name> : to replay commits of current branch on tip of the branch_name.

git branch -m <new_branch_name> : to rename the current branch name

git reset --hard : to reset working branch to a specific commit. If no commit specified, it reset to HEAD

git reset --hard HEAD^ : to reset working to previous commit. In below screenshot, after running this command, the "Demo commit" will be removed.


Back to posts