22

Is there an option to revert changes from a single chunk in Tig's Status View?

I mean functionality opposite to u or 1. I am aware of ! operation, but this one reverts the whole file - not just a single change.

houen
  • 931
  • 9
  • 18

1 Answers1

28

Yes, open the stage view by pressing Enter in the status view, move to the chunk you want to revert and press !.

Jonas Fonseca
  • 1,811
  • 15
  • 15
  • 4
    You are right - this works like `u`, great! But is there an option to revert just single line from the chunk (split it)? – houen Feb 18 '14 at 13:44
  • 5
    No, there is not you have to first stage the whole diff chunk and then unstage the line using `1` _and then_ revert. – Jonas Fonseca Mar 02 '14 at 22:12
  • 2
    For others, who are getting the error `Unknown key, press h for help ` you need to create the `~/.tigrc` file and type: `bind main ! !?git revert %(commit)` and save. Then you can use `!` in you main view itself. – zero Jan 28 '20 at 06:36
  • 2
    To revert means to revert an already committed change. In the stage view you can only see changes that are yet to be committed. I was more interested in knowing how can I pick a block of change from commit history and revert it. – Chirag Arora Nov 10 '20 at 13:42