msr_overflow
msr_overflow

Reputation: 122

"git checkout" Doesn't Update Files

my workflow with git is something like this: 1. pull --rebase from origin/master 2. create a new branch for a specific issue and make my changes on that branch 3. switch head back to master and then merge the new branch I've created to to master

from the documentation page, git checkout is suppose to

Updates files in the working tree to match the version in the index or the specified tree

however after I made changes to the new branch and checkout master and check the status using 'git status', the changed files is still present.

Worst of all, I have used the 'undo file changes' option in git extension for visual studio, now that even if I switch back to the branch I created using the 'checkout' command, I no longer see my changes. Is there anyway that I can redo those changes?

Upvotes: 1

Views: 3809

Answers (1)

sandesh247
sandesh247

Reputation: 1676

Before "checkout master", are you sure you are committing the files in the branch you are working on?

Make sure you commit the files in the branch you are working on. Otherwise, if git discards the changed files, you'll have lost them for ever.

If you do not want to commit the files yet, try looking at git stash. Git stash allows you to temporarily save your changes, without committing them to any branch.

Upvotes: 2

Related Questions