I am using gitlab for project hosting and ci for a project. I have a use case where I a developer has to add a file in his/her branch. But while merging that branch to master, one specific file should not be added to master branch.
I tried following solution to this:
- I added the filename(testfile) to gitignore of master and pushed the changes.
Then, I checked out a branch "dev" and added the file "testfile" using:
git add -f testfile
- the file got added and I committed and pushed the changes.
But, when I merged the "dev" branch to master, the testfile also got merged(added) in the master branch.
P.S. Technically, It shouldn't have been the case as I forced added the file only on dev branch and while merging I didn't even get the warning message.