0

I have two questions : I added a new branch to my local repo, so I have two 'master' and the new one 'new'. I added and committed some files in new, but when I switch back to master, the new added files are still in master. How can it be ?

By the way, I want to add a lot of files in new that I don't want to appear in master wen I merge new and master (but perhaps I need this 'excluded master merged files' to be merged in other branches). I know about .gitignore but here I want to restrict the merge to some specific files, how to do that (I have heard about submodules but it doesn't seem to math my specific issue)

epsilones
  • 11,279
  • 21
  • 61
  • 85
  • I suspect you are taking a wrong aproach, if you can explain a little bit more your case maybe I could suggest some alternatives. – FerCa Jan 14 '13 at 10:34
  • First, I don't understand why some files appear in the branch master since I only added and committed them in the branch 'new'. So I have two branches, in 'master' a list of folders. I created a branch from master called 'new', I added some folders that I don't ant to be merged when I will merge new into master. How can I exclude folders from merge without having to do too much by hand ? – epsilones Jan 14 '13 at 10:37
  • I don't know how these files can be in master if you only added and committed them to the checked out 'new' branch. Anyway I'm pretty sure for your case you have to use submodules.. If you wanna try another way have a look here: http://stackoverflow.com/questions/3868491/git-ignore-some-files-during-a-merge-keep-some-files-restricted-to-one-branch – gulty Jan 14 '13 at 11:06
  • I don't think submodules is the right thing to do because when you create a new branch, it integrates the created submodule – epsilones Jan 14 '13 at 11:33
  • 1
    Have you read through the .gitattributes (1st answer at the link I provided) ? If this doesnt fit you may have a look at this: http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html also the comments are quite helpful for a better workflow.. – gulty Jan 14 '13 at 13:00
  • thanks, I am going to check it – epsilones Jan 14 '13 at 13:40
  • You'll have better luck asking a single, specific question rather than bunching them up, and in explaining exactly what you're doing (ie what commands you're running, not just that you added some files). – me_and Jan 14 '13 at 15:22

0 Answers0