In a previous job, a couple of years ago, we used git with an (old) plugin, called "git up".
https://github.com/aanand/git-up
"This plugin is no longer maintained or supported."
Updating your workspace used to be very easy:
just type "git up", see what files have conflicts, edit those to resolve the conflicts, do a "git add", and you are done.
I am now working for another company. They started to use git earlier this year. We don't have a clear and simple way for everyone to update our workspace. I would like to introduce a very simple way to update your workspace. As simple as possible. No commits, no merges.
It seems the simplest way to do this is by using "git pull" with the --rebase and --autostash flags. You can do the same by setting these values in your .gitconfig file. Or with an alias:
git config --global alias.up '!git fetch && git rebase --autostash origin'
This kinda works. When there are no conflicts, the stash pops automatically. Besides typing "git up" or "git pull --rebase --autostash", there is nothing I need to do.
There is one issue. When there are conflicts, git refuses to apply the stash back into my workspace. It says:
Applying autostash resulted in conflicts.
Your changes are safe in the stash.
You can run "git stash pop" or "git stash drop" at any time.
Successfully rebased and updated refs/heads/main.
$ git stash list
stash@{0}: autostash
$
When I then type "git stash pop" the stash is popped, my local changes are automatically edited into my workspace again (with the usual >>>> and <<<< markers). This always succeeds.
Note, git always refuses to automatically pop the stash when I have changed a file that is also changed on the remote repository. Not only when there is a real conflict (changes on the same lines). But also when my change is nowhere near the change from the remote repository. This makes me suspect that the behaviour I see is really not intended.
But why does --autostash not pop the stash automatically? I spoke with my company's git support persons. They also expect the stash to pop automatically. Even when there are conflicts. I did a bit of googling. Nothing I found suggests that the stash should not pop automatically.
So my question: What can I expect? Should the stash always pop automatically when I use --autostash? Or is the behaviour I see normal? Is this a bug? Did our local git-team change something in the executables or global config? (They say they didn't).
Behaviour is the same with 2.26.2 and 2.33. Thanks.