问题
I guess this question is hard to understand, so here's an example:
Assume I have a Project and I'm using Git, with files A,B,C on Master branch... then I create a Test branch and create file D and modify file A with some lines. after this I push to [Bitbucket, Github] and so I have a Master Branch With 3 Files and a Test Branch with 4 Files.
I go back to Master branch and start working on something else, something different, and when I try to commit it says that I should Add D file and it's going to commit the changes on file A.
My question is, how can I avoid this changes on Master Branch? and how should I deal with this on my local folder? if I want it to look just like 'Master' branch should I delete the folder and clone the repo, delete the file D and revert changes on file A by myself, or what should be the ideal way to do it?
回答1:
You would have to provide your exact sequence of commands to get a correct answer.
But from what you have written I'd guess that you did not commit those changes to Test branch, but maybe only added them to the index and then did a push or something like that?
Because if you would have committed to Test Branch and then checked out master, your changes and your new file would not be in the working tree.
来源:https://stackoverflow.com/questions/36925672/how-to-avoid-pushing-branch-specific-files-to-master-branch