0

I have made changes to certain files (docker-init etc) for debugging purposes and I don't intend to push those changes to master.

Whenever I do a rebase, I either need to stash my changes or do a commit and later undo it. This is a bit tedious to be honest.

I don't want git to track changes on those files but I can't add the files to gitignore as they might be removed from the master branch. Or can I?

David Maze
  • 130,717
  • 29
  • 175
  • 215
pykam
  • 1,223
  • 6
  • 16
  • 1
    https://stackoverflow.com/questions/30208928/can-git-pull-automatically-stash-and-pop-pending-changes — does this answers your question? – Shadows In Rain Apr 08 '21 at 11:45
  • 2
    If the files are not tracked by git and are not overwritten by the rebase, you don't need to do anything. If `git stash` and `git stash pop` are too tedious, I suggest you have an unrealistic view of tedium! – William Pursell Apr 08 '21 at 11:50
  • 1
    Make a shell function: `pull() { git stash; git pull -r; git stash pop; }` – William Pursell Apr 08 '21 at 11:51
  • 1
    Or you do commit those changes. That doesn't mean that you have to push them. – mkrieger1 Apr 08 '21 at 12:04
  • 1
    following @mkrieger1's comment : you may at least keep these changes in a side branch, so that if you (accidentally or willingly) discard these changes, getting them back becomes as simple as `git cherry-pick my/debugging/changes` (I'm all against tediousness too, I aliased `git` to `g` and `cherry-pick` to `cp` ;) ) – LeGEC Apr 08 '21 at 13:26
  • Very helpful comments, thanks all! – pykam Apr 08 '21 at 13:34

0 Answers0