Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

Up until now, I have always used git checkout <branch_name>; git reset --hard <hash> to move a branch back to an earlier commit.

Then I came across this questionthis question, but the answers and comments do not explain in great detail the differences between them.

Assuming I have a clean working tree, what internal differences are there between

git branch -f <branch_name> <hash>

and

git checkout <branch_name>
git reset --hard <hash>

and do such differences, if any, have any subtle implications for advanced usage?

Up until now, I have always used git checkout <branch_name>; git reset --hard <hash> to move a branch back to an earlier commit.

Then I came across this question, but the answers and comments do not explain in great detail the differences between them.

Assuming I have a clean working tree, what internal differences are there between

git branch -f <branch_name> <hash>

and

git checkout <branch_name>
git reset --hard <hash>

and do such differences, if any, have any subtle implications for advanced usage?

Up until now, I have always used git checkout <branch_name>; git reset --hard <hash> to move a branch back to an earlier commit.

Then I came across this question, but the answers and comments do not explain in great detail the differences between them.

Assuming I have a clean working tree, what internal differences are there between

git branch -f <branch_name> <hash>

and

git checkout <branch_name>
git reset --hard <hash>

and do such differences, if any, have any subtle implications for advanced usage?

edited tags
Link
haccks
  • 105.4k
  • 26
  • 179
  • 269
edited title
Source Link
merlin2011
  • 74k
  • 45
  • 207
  • 347

Is there any difference Difference between `git branch -f <branch_name> <hash>` and `git checkout <branch_name>; git reset --hard <hash>` under a clean working tree?

Up until now, I have always used git checkout <branch_name>; git reset --hard <hash> to move my currenta branch back to an earlier branchcommit.

Then I came across this question, but the answers and comments do not explain in great detail the differences between them.

Assuming I have a clean working tree, what internal differences are there between git branch -f <branch_name> <hash>

git branch -f <branch_name> <hash>

and git checkout <branch_name>; git reset --hard hash,

git checkout <branch_name>
git reset --hard <hash>

and do such differences, if any, have any subtle implications for advanced usage?

Is there any difference between `git branch -f <branch_name> <hash>` and `git reset --hard <hash>` under a clean working tree?

Up until now, I have always used git reset --hard <hash> to move my current branch back to an earlier branch.

Then I came across this question, but the answers and comments do not explain in great detail the differences between them.

Assuming I have a clean working tree, what internal differences are there between git branch -f <branch_name> <hash> and git checkout <branch_name>; git reset --hard hash, and do such differences, if any, have any subtle implications for advanced usage?

Difference between `git branch -f <branch_name> <hash>` and `git checkout <branch_name>; git reset --hard <hash>` under a clean working tree?

Up until now, I have always used git checkout <branch_name>; git reset --hard <hash> to move a branch back to an earlier commit.

Then I came across this question, but the answers and comments do not explain in great detail the differences between them.

Assuming I have a clean working tree, what internal differences are there between

git branch -f <branch_name> <hash>

and

git checkout <branch_name>
git reset --hard <hash>

and do such differences, if any, have any subtle implications for advanced usage?

Source Link
merlin2011
  • 74k
  • 45
  • 207
  • 347
Loading