Answers for "git reset to commit"

3

git reset to commit

# reset to specefic commit
git reset --hard <commit id>

# to go back one step 
git reset --hard HEAD~1

# note: use --soft to keep file changes
Posted by: Guest on March-05-2021
5

git soft reset head

git reset --soft HEAD^
//resets head by 1
Posted by: Guest on August-13-2020
0

git reset to latest commit

git reset --hard HEAD~0
will go to latest commit.


git reset --hard HEAD~1
will go to last but one commit.

Note:  Be careful while running this command. it can't be irreversible
Posted by: Guest on June-29-2021
3

git reset head

sudo git reset --hard Head
Posted by: Guest on December-09-2020
8

git roll back to specific commit

//Git Rollback to a specific commit via Mac terminal

//Navigate to project and open git log
cd projectname
git log --oneline

//Locate and checkout the desired commit ID
git checkout abc1234 . 

//(Type q to quit the git log)

//Stage All changes, commit with comment, and push to remote
git add -A
git commit -m "Revert commit: abc1234"
git push
Posted by: Guest on January-10-2020
6

git go back to previous commit

git checkout 12feg3435 #commit ID
Posted by: Guest on January-13-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language