Basically I have two branches, main and branchA. In branchA I add sql files, so that GIT tracks their changes. But when I merge this branch back to main, I want the main branch to ignore all sql files. Basically, I don't want the main branch to even have sql files committed, since they should only exist as development aids. Is this possibly?
Asked
Active
Viewed 170 times
0
-
1Possible duplicate of [Using git, how do I ignore a file in one branch but have it committed in another branch?](http://stackoverflow.com/questions/1836742/using-git-how-do-i-ignore-a-file-in-one-branch-but-have-it-committed-in-another) – Devanshu Dwivedi Apr 01 '16 at 20:53
-
Solution does not work. That question should be deleted from stackoverflow. Read [this](https://stackoverflow.com/questions/29579546/git-excludesfile-for-a-branch) – bastos.sergio Apr 04 '16 at 13:12
1 Answers
2
After committing the sql files in your branch A, you can add these files in gitignore and commit it.
Or, in main branch, you can execute the following git command to ignore these file changes:
git update-index --no-assume-unchanged

Aparna
- 255
- 1
- 8
-
Is it possible to have the gitignore configured per branch? In main it ignores sql, and in branchA it does not... – bastos.sergio Apr 01 '16 at 18:06
-
Yes of course, it is possible but you need to manage it very carefully. – Aparna Apr 05 '16 at 16:07