Behavior of git checkout Checking out an earlier commit will change the state of at least one file. This is sometimes true . Git doesn't allow you to save a new commit if no files have been updated, so you might think this is always true. However, it's possible to do the following: Save a commit (call this commit 1). Update some files and save another commit (call this commit 2). Change all the files back to their state during commit 1, then save again (call this commit 3). This sometimes happens if commit 2 contained a bug, and it's important to fix the bug quickly. The easiest thing to do might be to remove all the changes introduced by commit 2 to fix the bug, then figure out how to safely reintroduce the changes later. At this point, commit 3 is the latest commit, so if you checkout commit 1, none of the files will be changed. Checking out an earlier commit will change the state of more than one file. Checking out an earlier commit will change the sta...
Yorumlar
Yorum Gönder