Reputation: 33900
I want to have some private data in git controlled sources, usually a comment or a reminder for myself. I do not want this part of the code be committed but only stay in my local copy of the file. Also when the file is updated remotely, the merge should happen painlessly, so my private lines are held intact. Is there a way to achieve this?
Previously I had a wrapper, that would be called each time before and after the git executes, and will strip my data before the git execution and then restore it afterwards. But I am looking for a better solution.
Here is how my private data looked:
/*private
some privately seen comment
*/
//private-begin
some code that will not go into commits.
//private-end
Usually I have to keep the private data in .gitignore'd files, but this is sometimes inconvenient.
Upvotes: 0
Views: 22
Reputation: 9238
Keeping changes uncommitted is not really well supported, especially through merges and rebases. There are 2 alternatives:
use git stash
before you update your repository, to move changes away and git stash pop
when you back to coding
commit them and use git rebase
to keep them from commits you push to remote repositories
Upvotes: 1