Improve save/load aliases
When `git load` is invoked it will check if the subject of the `HEAD` commit message is `temp!`, if it is when the commit will be reset, otherwise an error message is output and the commit remains untouched.
This commit is contained in:
parent
dcacddc27f
commit
467789389a
@ -25,9 +25,10 @@ than remember the plumbing term of a specific command.
|
|||||||
* `changes` compare the list of commits on the local branch to another branch,
|
* `changes` compare the list of commits on the local branch to another branch,
|
||||||
e.g. when on a feature branch `git changes master` lists the commits which are
|
e.g. when on a feature branch `git changes master` lists the commits which are
|
||||||
not present on the master branch.
|
not present on the master branch.
|
||||||
* `save` like pushing to the stash but attached to a branch, shorthand for
|
* `save` like pushing to the stash but attached to the current branch, shorthand
|
||||||
`git commit -am temp`.
|
for `git commit -am "temp!"`.
|
||||||
* `load` like popping from the stash but attached to a branch, shorthand for
|
* `load` like popping from the stash but attached to the current branch, if
|
||||||
`git reset --mixed HEAD`.
|
`HEAD` has the subject `temp!` then `git reset --mixed HEAD~` is executed,
|
||||||
|
otherwise the message `error: commit subject is not: temp!` is output.
|
||||||
|
|
||||||
[git]: https://git-scm.com
|
[git]: https://git-scm.com
|
||||||
|
5
config
5
config
@ -21,8 +21,9 @@
|
|||||||
tree = log --graph --abbrev-commit --oneline --decorate \
|
tree = log --graph --abbrev-commit --oneline --decorate \
|
||||||
--format=format:'%C(yellow)%h%C(reset) %C(blue)%aD%C(reset) %C(green)(%ar)%C(reset)%C(bold)%d%C(reset)%n %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
|
--format=format:'%C(yellow)%h%C(reset) %C(blue)%aD%C(reset) %C(green)(%ar)%C(reset)%C(bold)%d%C(reset)%n %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
|
||||||
|
|
||||||
save = commit -am temp
|
save = commit -am "temp!"
|
||||||
load = reset --mixed HEAD~
|
load = !sh -c '[ \"temp!\" = \"`git show --format=%s --no-patch`\" ] && \
|
||||||
|
git reset --mixed HEAD~ || echo \"error: commit subject is not: temp!\"'
|
||||||
|
|
||||||
[commit]
|
[commit]
|
||||||
verbose = true
|
verbose = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user