Git checkout doesn't change anything, and it's getting very frustrating
Posted
by
Josh
on Stack Overflow
See other posts from Stack Overflow
or by Josh
Published on 2010-12-23T03:30:26Z
Indexed on
2010/12/23
3:54 UTC
Read the original article
Hit count: 406
I really like git. At least, I like the idea of git. Being able to checkout my master project as a separate branch where I can change whatever I want without risk of screwing everything else up is awesome. But it's not working.
Every time I checkout a branch to another branch, make changes to the one branch, and then checkout the original branch, I still have all the files and changes that happened in the other branch. This is getting extremely frustrating. I've read that this can happen when you have files open in the IDE while doing this, but I've been pretty careful about that and both closed the files in the IDE, closed the IDE, and shut down my rails server before switching branches, and this still happens. Also, running 'git clean -f' either deletes everything that happened after some arbitrary commit (and randomly, at that), or, as in the latest case, didn't change anything back to its original state.
I thought I was using git correctly, but at this point, I'm at my wit's end here. I'm trying to work with a bunch of experimental code using a stable version of my project, but I keep having to manually track down and fix all the changes I made. Any ideas or suggestions?
git checkout -b photo_tagging
git branch # to make sure it's right
# make a bunch of changes, creations, etc
git status # see what's changed since before
git add . # approve of the changes, I guess, since if I do git commit after this, it says no changes
git commit -m 'these are changes I made'
git checkout master
git branch #=> *master
# look at files, tags_controller is still there, added in photo_tagging
# and code added in photo_tagging branch are still there in *master
This seems to happen whether I do a commit or not on the branch.
© Stack Overflow or respective owner