2

I created a repository with two branches. The first branch contains a Unity project and a .gitignore file that generates GitHub. The other branch has latex files to create the documentation and other .gitignore file that is generated by GitHub too.

When I am working in the doc branch and I compile my latex files, they generate a main.syctex.gz file which is ignored by my .gitignore. Everything until here is ok. However, when I type git push -u origin doc and I switch the doc branch to the master branch, the file ignored (main.syctex.gz) appears in the master branch.

I know that if I type git clean -f -d I can clean the Doc folder that contains main.syctex.gz in the master branch. But, I would be grateful if someone can tell me another option to fix this problem.

CrisGmz
  • 43
  • 6

1 Answers1

0

Another option would be two have two different workspaces (working trees) for the same cloned (cloned only once) repository.

See git worktree: you can then work on both branches without worrying about the checkout part.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you for your help! – CrisGmz Oct 15 '17 at 11:03
  • @CrisGmz of course, ignoring both set of files in one .gitignore works too, but I prefer avoiding data leaking from one branch to another, ie avoiding that one branch has to known about files from another branch. – VonC Oct 15 '17 at 11:04
  • You are right. I'll take it into account for future repositories. Thanks again! – CrisGmz Oct 15 '17 at 11:09