Re: [PATCH 1/2] pull: respect rebase.autostash

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 1/2] pull: respect rebase.autostash

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:57:44

Ramkumar Ramachandra [off-list ref] writes:
quoted hunk
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -44,6 +44,7 @@ merge_args= edit=
 curr_branch=$(git symbolic-ref -q HEAD)
 curr_branch_short="${curr_branch#refs/heads/}"
 rebase=$(git config --bool branch.$curr_branch_short.rebase)
+autostash=$(git config --bool rebase.autostash)
 if test -z "$rebase"
 then
 	rebase=$(git config --bool pull.rebase)
@@ -203,6 +204,7 @@ test true = "$rebase" && {
 			die "$(gettext "updating an unborn branch with changes added to the index")"
 		fi
 	else
+		test true = "$autostash" ||
 		require_clean_work_tree "pull with rebase" "Please commit or stash them."
Trivial, indeed!

It would be nice to have an --autostash command-line option too, and the
error message in "require_clean_work_tree" could suggest using it. That
would make the feature easily discoverable.

Perhaps this patch could mention "pull --rebase" in the doc, like (config.txt)

- 	ends.  This means that you can run rebase on a dirty worktree.
+ 	ends.  This means that you can run rebase or `git pull --rebase` on a dirty worktree.

(or perhaps it's obvious enough and not needed)

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

Re: [PATCH 1/2] pull: respect rebase.autostash

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:44

Matthieu Moy wrote:
It would be nice to have an --autostash command-line option too,
I thought it would be a bit ugly, since it's already overloaded with
options to pass to merge.
and the
error message in "require_clean_work_tree" could suggest using it. That
would make the feature easily discoverable.
Cannot pull with rebase: You have unstaged changes.
Please commit or stash them.  See also: rebase.autostash in git-config(1).
Perhaps this patch could mention "pull --rebase" in the doc, like (config.txt)
--- a/Documentation/git-pull.txt
+++ b/Documentation/git-pull.txt
@@ -112,5 +112,6 @@ include::merge-options.txt[]
 See `pull.rebase`, `branch.<name>.rebase` and `branch.autosetuprebase` in
 linkgit:git-config[1] if you want to make `git pull` always use
-`--rebase` instead of merging.
+`--rebase` instead of merging.  See `rebase.autostash` in
+linkgit:git-config[1] if you want to be able to run on a dirty worktree.
 +
Thanks.

Re: [PATCH 1/2] pull: respect rebase.autostash

From: Phil Hord <hidden>
Date: 2016-06-15 22:57:44

On Fri, Jun 14, 2013 at 6:41 AM, Ramkumar Ramachandra
[off-list ref] wrote:
Matthieu Moy wrote:
quoted
It would be nice to have an --autostash command-line option too,
I thought it would be a bit ugly, since it's already overloaded with
options to pass to merge.
Eventually I think a switch will be needed.  At least there is
   git -c rebase.autostash=false

But we will probably need to also have --no-autostash for scripts and users.


Phil
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help