4

what git function allows me to approve/deny each change a commit will make?

I remember seeing this when I first started gitting, but can't seem to find it now...

I know I've done it once, where it gave a list of single letters, and each letter was a different aprove/deny/skip function. Does anyone know what I am talking about?

d-_-b
  • 21,536
  • 40
  • 150
  • 256
  • I guess you mean cherry picking: see http://stackoverflow.com/questions/1241720/git-cherry-pick-vs-merge-workflow – mbx Sep 19 '12 at 15:28
  • 1
    I don't think there is such a function. When doing normal commits, you can selectively specify hunks to commit though. – knittl Sep 19 '12 at 15:28
  • Yes! how do i selectively specify hunks to commit? – d-_-b Sep 19 '12 at 15:28
  • 1
    Not tested, but you can start with `git merge --no-commit`, then you ought to be able to use combinations of `git add -p`, `git reset`, `git checkout`, etc. to accomplish what you want. I don't think there's a "simple" or "one command" way to do it, though. – twalberg Sep 19 '12 at 15:45
  • @twalberg Thanks! i think it was `git add -p` that I was looking for and will test this out when I get home. If that's the case, then sorry for the incorrect title :) Although, I'm definitely still interested in finding out how to go change-by-change through a merge. – d-_-b Sep 19 '12 at 15:52

4 Answers4

4

You're describing "git add -p".

nturner
  • 146
  • 6
1

Have a look at "git rebase -i" and then "git rebase --continue"

I believe that this is what you are looking for. But remember this work at commits level (not single lines).

Boris Bucha
  • 630
  • 4
  • 6
1

Not tested, but you can start with git merge --no-commit, then you ought to be able to use combinations of git add -p, git reset, git checkout, etc. to accomplish what you want. I don't think there's a "simple" or "one command" way to do it, though.

twalberg
  • 59,951
  • 11
  • 89
  • 84
1

You are describing the "interactive mode" git add -i.

Something like this:

         staged     unstaged path
1:    unchanged        +3/-1 README.md
2:    unchanged        +1/-1 _layouts/default.html

*** Commands ***
1: status   2: update  3: revert  4: add untracked
5: patch    6: diff    7: quit    8: help
What now> 
J-16 SDiZ
  • 26,473
  • 4
  • 65
  • 84