From: Phillip Wood <phillip.wood123@gmail•com>
To: Brooke Kuhlmann <brooke@alchemists•io>, phillip.wood@dunelm•org.uk
Cc: git@vger•kernel.org, "brian m . carlson" <sandals@crustytoothpaste•net>
Subject: Re: Git Stash Synchronization - Best Workflow?
Date: Wed, 10 Sep 2025 10:52:44 +0100 [thread overview]
Message-ID: <94d614fb-63b8-4733-b78d-b55c482fbed8@gmail.com> (raw)
In-Reply-To: <FEB150D4-2B5E-41CF-ADCE-93DD0B48D364@alchemists.io>
Hi Brooke
On 06/09/2025 13:50, Brooke Kuhlmann wrote:
>> That sounds like a bug if you're getting the rejected message above
>> but the ref on the remote is still being updated. I'll try and take
>> a look at that next week.
I'm unable to reproduce this. In the script below the final push succeeds.
set -ex
dir="$(mktemp -d)"
cd "$dir"
git init --bare origin
git init repo
cd repo
git remote add origin "file://${PWD%/*}/origin"
git config core.logAllRefUpdates always
git config remote.origin.fetch refs/stashes/*:refs/remote/origin/stashes/*
echo a >a
git add a
git commit -m a
echo b >a
git stash push
echo c >a
git stash push
git stash export --to-ref refs/stashes/test
git push origin refs/stashes/test
git stash pop
git stash push -m message
git stash export --to-ref refs/stashes/test
git push --force-with-lease --force-if-includes origin refs/stashes/test
>> You need to pass the name of the ref whose reflog you want to look at,
>> otherwise it defaults to showing the reflog for HEAD. You should be
>> able to see the reflog for you exported stashes.>
> I gave this a try and every time I use `git reflog refs/stashes/$USER`,
> I always get a blank response. No errors and no output.
Ah, I wonder if core.logAllRefUpdates only affects the creation of new
refs. You can force the creation of a reflog by running
oid=$(git rev-parse --verify refs/stashes/$USER) &&
git update-ref -d refs/stashes/$USER &&
git update-ref --create-reflog -m 'export stashes' refs/stashes/$USER $oid
the same applies to refs/remote/stashes/origin/$USER
>> Let's try and find why the remote update say's it rejected when it isn't
>> and then we can think about the best way to document pushing and
>> pulling exported stashes.
I haven't thought much about the pulling side of this. "git stash import"
appends to the existing stashes so I'm not sure how we'd cope with forced
updates - have got got any experience of handling this from your
experiments?
Thanks
Phillip
next prev parent reply other threads:[~2025-09-10 9:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-31 23:25 Git Stash Synchronization - Best Workflow? Brooke Kuhlmann
2025-09-01 10:10 ` Phillip Wood
2025-09-01 20:48 ` Brooke Kuhlmann
2025-09-05 14:03 ` Phillip Wood
2025-09-06 12:50 ` Brooke Kuhlmann
2025-09-10 9:52 ` Phillip Wood [this message]
2025-09-11 2:22 ` Brooke Kuhlmann
2025-09-19 14:04 ` Phillip Wood
[not found] ` <A42DC91A-91F2-4AB6-B0EE-52DE5135E99E@alchemists.io>
2025-09-19 19:54 ` Brooke Kuhlmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=94d614fb-63b8-4733-b78d-b55c482fbed8@gmail.com \
--to=phillip.wood123@gmail$(echo .)com \
--cc=brooke@alchemists$(echo .)io \
--cc=git@vger$(echo .)kernel.org \
--cc=phillip.wood@dunelm$(echo .)org.uk \
--cc=sandals@crustytoothpaste$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox