0

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?

bastos.sergio
  • 6,684
  • 4
  • 26
  • 36
  • 1
    Possible 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 Answers1

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