exebook
exebook

Reputation: 33900

Private data in git-controlled sources

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

Answers (1)

max630
max630

Reputation: 9238

Keeping changes uncommitted is not really well supported, especially through merges and rebases. There are 2 alternatives:

  1. use git stash before you update your repository, to move changes away and git stash pop when you back to coding

  2. commit them and use git rebase to keep them from commits you push to remote repositories

Upvotes: 1

Related Questions