i don't understand why everybody keeps complaining about git; it's just an… AHHHH
=> More informations about this toot | More toots from hynek@mastodon.social
In case y'all wonder how I, a professional programmer, have solved this mess:
git diff >name.diff
git switch main
git branch -m name backup-name
git checkout -b name
patch -p0 <name.diff
git push --force
🫡
=> More informations about this toot | More toots from hynek@mastodon.social
@hynek no idea how git would work without push --force
...
=> More informations about this toot | More toots from tymwol@hachyderm.io
@tymwol there's been force pushes; it's the result of mixing rebases (local) and merges (github)
=> More informations about this toot | More toots from hynek@mastodon.social
@hynek @tymwol I try to avoid this by the following git config:
[pull]
rebase = interactive
[rebase]
autostash = true
=> More informations about this toot | More toots from veit@mastodon.social
@veit @hynek how does it help to avoid it, could you elaborate?
=> More informations about this toot | More toots from tymwol@hachyderm.io
@tymwol @hynek git pull --rebase combines git fetch with git rebase --onto. This allows you to rearrange and edit commits.
See also https://womanonrails.com/git-rebase-onto
And rebase with autostash ensures that changes in the working directory do not get in the way.
I hope it’s now a little clearer.
=> More informations about this toot | More toots from veit@mastodon.social
@veit @hynek thanks, git always surprises me with its endless number of features
=> More informations about this toot | More toots from tymwol@hachyderm.io
@tymwol @hynek You’re not alone. We have continued to optimise our Git workflow over the years, and this will probably continue for a while yet.
=> More informations about this toot | More toots from veit@mastodon.social
@veit @tymwol I don't think that would've prevented my situation because it's caused by a combination of local git rebase + git push -f and remote git merge.
=> More informations about this toot | More toots from hynek@mastodon.social
@hynek @tymwol Ok, I forgot to mention that I always execute the force push with --force-with-lease.
=> More informations about this toot | More toots from veit@mastodon.social
@hynek my "git workflow" is typically:
git diff > /tmp/foo
cd ..
rm -rf myrepo
git clone ...
cd myrepo
patch -p0 < /tmp/foo
I'm mostly just angry that we didn't get an RCS descendant commandline interface. :/
=> More informations about this toot | More toots from jerub@mastodon.social
@jerub looks like i'm the advanced git user of the two of us! 🏆
=> More informations about this toot | More toots from hynek@mastodon.social
@hynek Also, i'm excellent at responding to the correct post on mastodon.
=> More informations about this toot | More toots from jerub@mastodon.social
@hynek Both of us are Professional Programmers!
=> More informations about this toot | More toots from jerub@mastodon.social
@jerub so professional!
=> More informations about this toot | More toots from hynek@mastodon.social
@hynek --force-with-lease is my default for pushes
=> More informations about this toot | More toots from hvdklauw@mastodon.social
@hynek I can sympathize with the frustration. In case it helps, I've got a shell function that automates this sort of last resort workflow when git gives me unnecessary headaches: https://www.julienphalip.com/blog/git-hard-rebase/
=> More informations about this toot | More toots from julienphalip@hachyderm.io
@hynek how could I create such a mess (which I’ve never seen before)?
=> More informations about this toot | More toots from johnb@sfba.social This content has been proxied by September (3851b).Proxy Information
text/gemini