I'm working on a C++ project using git. Since we all use different IDE we all have our own project files. But I don't want to change the files added to the project all the time I switch the branch. So is there a way to have the project file in the versioning but never push it to the remote?
Asked
Active
Viewed 43 times
0
-
2Why not put them in `.gitignore`? – Oliver Charlesworth May 28 '17 at 10:01
-
https://stackoverflow.com/questions/1753070/how-to-ignore-files-only-locally-in-git – Cody Gray - on strike May 28 '17 at 10:02
-
a .gitignore and as far as i understood the problem from the link the exclude will simply ignore the files from commits. I use them but that's not what i'm looking for. I want the vs project file being part of the repository. So on every commit I may changed the project file and that should be saved. But I don't want this to be uploaded. So commit yes, push no. – Stack May 30 '17 at 08:24
1 Answers
0
Yes there is a way of doing what you want
When you want to switch of branch, before switching you can use the command :
git stash
this command creates a LOCAL commit, that will never be puched, it's like a commit -am "nothing" but only versionned locally
after that you can use :
git checkout your_branch
when you return to the fist branch :
git checkout bnach_1
you can re-merge the local modifications done before switching by doing
git stash pop
There is more options on git stash available here

D. Peter
- 487
- 3
- 12
-
This comes closer to my problem, but when i stash the project file it is gone. and i want to keep it locally. So when i do a commit i want the project file saved too, like all the other files. But i never want to push it – Stack May 30 '17 at 08:46