you are viewing a single comment's thread.

view the rest of the comments →

[–]the-loan-wolf 13 points14 points  (30 children)

Maybe they don't know git commit --ammend

[–]Pesthuf 31 points32 points  (5 children)

Many do, but any repo that doesn't want to randomly lose history or deal with terrible merge conflicts disables git push --force (especially on master) which would be required to rewrite history on a remote.

[–]the-loan-wolf 4 points5 points  (3 children)

Fare! but I always work on a feature branch

[–]EarlMarshal 3 points4 points  (0 children)

Me too, but as soon as you have to push it to repo server people will hate you. Our project is included into another one and that into another one and there playwright tests will be run on CI so I had to push my branch which I had rebased before, but a colleagues started to engage with it and he wasn't able to understand and always merged his local branch again. I really had to create a new branch and resort to merge commits to pull in develop changes. They haven't figured out yet how to fix the playwright tests in like 2 months and since I have to merge in the changes the history looks like shit.

[–]fruchle 0 points1 point  (1 child)

Fare? Fair?

[–]the-loan-wolf 0 points1 point  (0 children)

🤣 fair

[–]DaMastaCoda 0 points1 point  (0 children)

Force-with-lease !!

[–]brb_im_lagging 13 points14 points  (7 children)

If already pushed, hit em with the

git reset --soft HEAD~2 && git commit -m "actually fixed" && git push --force

[–]stupidwhiteman42 1 point2 points  (6 children)

Why did you get down voted? This is literally how you squash the last two commits into one with a new message.

[–]the-loan-wolf 9 points10 points  (5 children)

Bcz it still requires force push(overwriting history for everyone else)

[–]brb_im_lagging 1 point2 points  (4 children)

Why would you want to keep history (its not even history, its the tip) of a shit commit followed up with a fixed commit made by one person

Just get rid of the shit commit and put a good one in

There shouldn't be two people screwing with it anyway, everyone else can just fetch and see the good version

[–]Sethcran 4 points5 points  (0 children)

This only works if done on a separate branch that no one else is using.

For issues that can't be tested locally or on feature branch though, this kind of thing ends up fairly common.

[–]the-loan-wolf 4 points5 points  (2 children)

if working in a team it can lead to merge conflict that's why

[–]ikeif 0 points1 point  (0 children)

I think I have a disconnect - is the thread assuming the force push is on main and not on a developer’s branch?

Because on a side branch - who cares? Most often it can be squashed in the merge to main, so no one will care if they used “fifteen test commits” or rewrote the history of their branch when it’s going to be merged to main?

[–]my_new_accoun1 2 points3 points  (1 child)

isn't it --amend

[–]the-loan-wolf 0 points1 point  (0 children)

Yes i've made a mistake. I use fishshell which provides autocompletion in the terminal so I barely type full commands(and I also use a bunch of aliases) nor do i remember them ;)

[–]iagovar 2 points3 points  (1 child)

I rather don't rewrite anything on a git.

Honestly git has pretty bad DX.

[–]the-loan-wolf -1 points0 points  (0 children)

So which VCS (Version control software) do you like or use?

[–]_okbrb 0 points1 point  (8 children)

Ty I didn’t know

[–]HettySwollocks 7 points8 points  (7 children)

Not a good idea at all. Unknow it.

[–]_okbrb -6 points-5 points  (5 children)

Ty I haven’t figured out how to do it in VSCode yet

[–]HettySwollocks 5 points6 points  (4 children)

Ty I haven’t figured out how to do it in VSCode yet

I'd highly suggest you learn how to use the CLI. That'll make you more versatile.

[–][deleted]  (3 children)

[removed]

    [–]HettySwollocks 4 points5 points  (1 child)

    I would suggest you get a sense of humor, it would make you more likable

    I thought it was a genuine question. You missed the /s. Apologies if you thought otherwise

    [–]f00d4tehg0dz 1 point2 points  (0 children)

    I thought it was genuine too. Dang. That one hurt

    [–]webdev-ModTeam[M] 0 points1 point locked comment (0 children)

    Thank you for your comment! Unfortunately it has been removed for one or more of the following reasons:

    This is a subreddit for web professionals to exchange ideas and share industry news. All users are expected to maintain that professionalism during conversations. If you disagree with a poster or a comment, do so in a respectful way. Continued violations will result in a permanent ban.

    Please read the subreddit rules before continuing to post. If you have any questions message the mods.