1
- git-uncommit: uncommit and recommit commands for Git, save your commits to patch files
1
+ git-uncommit: uncommit and recommit commands for Git, undo commit to patch file
2
2
3
3
Git uncommit does exactly what it says: it uncommits the last Git commit, saving the patch.
4
4
5
5
Git recommit applies back the last uncommitted patch; after the patch is applied, the patch file is deleted.
6
6
7
- Usage:
7
+ ## Usage:
8
8
9
9
Let's suppose after much work you have just committed experimental changes to your branch.
10
10
11
- ```` shell
11
+ ```` sh
12
12
$ git-commit -m " Experimental changes"
13
13
````
14
14
15
15
You are unsatisfied with the result, but do not want to discard the work, so you run ``` git-uncommit ```
16
16
17
17
18
- ```` shell
18
+ ```` sh
19
19
$ git-uncommit
20
20
Uncommit: 2edf199-experimental-changes.patch
21
21
````
22
- The patch created by ``` git-uncommit ``` using ``` git format-patch ``` and is saved to a file: 2edf199-experimental-changes.patch
23
22
24
- Comparison with related git commands:
23
+ This undoes your experimental commit and creates ``` 2edf199-experimental-changes.patch ``` .
24
+
25
+ You can undo in this way any number of commits; ``` git-recommit ``` can be used to apply the patches
26
+
27
+ To apply the last uncommitted patch:
28
+
29
+
30
+ ```` sh
31
+ $ git-recommit
32
+ ````
33
+
34
+ To run ``` git-recommit ``` with any saved patch file to reapply it in the order you want:
35
+
36
+ ```` sh
37
+ $ git-recommit < patch-file> .patch
38
+ ````
39
+
40
+ ## Patches
41
+
42
+ Patches can be readily edited, shared with others and applied in a new order.
43
+
44
+ Patches are created using ``` git format-patch ```
45
+
46
+ ## Comparison with related git commands:
25
47
26
48
``` git stash ``` can sometimes be used for similar purposes as ``` git-uncommit ``` , the differences are:
27
49
* git stash operates on changes to the work tree or index, not already committed changes
@@ -32,3 +54,27 @@ Comparison with related git commands:
32
54
``` stg ``` or ``` STGit ``` : a tool that can also be used to reorder or edit commits, the main differences are:
33
55
* ``` STGit ``` has a much more complex set of command
34
56
* it does not save patch files automatically
57
+
58
+ ## Installation
59
+
60
+ ``` git-uncommit ``` and ``` git-recommit ``` are stand-alone shell scripts, simply requiring Git to be installed.
61
+
62
+ In a Unix or Linux system, you can quickly install ``` git-recommit ``` and ``` git-uncommit ``` by copying the files to /usr/local/bin.
63
+
64
+ ## Author and licensing terms
65
+
66
+ ````
67
+ Copyright (c) 2012, 2013 Michele Bini <michele.bini@gmail.com>
68
+
69
+ This program is free software: you can redistribute it and/or modify
70
+ it under the terms of the version 3 of the GNU General Public License
71
+ as published by the Free Software Foundation.
72
+
73
+ This program is distributed in the hope that it will be useful, but
74
+ WITHOUT ANY WARRANTY; without even the implied warranty of
75
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
76
+ General Public License for more details.
77
+
78
+ You should have received a copy of the GNU General Public License
79
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
80
+ ````
0 commit comments