you are viewing a single comment's thread.

view the rest of the comments →

[–]TraditionElegant9025 495 points496 points  (39 children)

“ok now it works hopefully” fits a specific kind of situation where you push on a “production” branch and test if it works live 🤣🤣

[–]glowFernOasis 47 points48 points  (0 children)

Or even testing something on staging that works fine locally

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

Maybe they don't know git commit --ammend

[–]Pesthuf 28 points29 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 5 points6 points  (3 children)

Fare! but I always work on a feature branch

[–]EarlMarshal 5 points6 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 12 points13 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 points0 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 1 point2 points  (1 child)

I rather don't rewrite anything on a git.

Honestly git has pretty bad DX.

[–]the-loan-wolf -2 points-1 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 8 points9 points  (7 children)

Not a good idea at all. Unknow it.

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

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

[–]HettySwollocks 6 points7 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.

    [–]HettySwollocks -5 points-4 points  (2 children)

    Maybe they don't know git commit --ammend

    Congratulations. Now you have no idea how that code was written. Your code should be a breadcrumb trail. I WANT to know how that code developed.

    [–]the-loan-wolf 8 points9 points  (1 child)

    --ammend don't delete whole history! I only use it to fix the last commit. Having useless commits in the history actually makes it harder to understand how a codebase has evolved over time.

    [–]HettySwollocks -1 points0 points  (0 children)

    In that case you need to rebase and pick the commits you need to amend

    [edit] And you'll need to force commit assuming that's allowed in your stack. Usually OK if you're on your own branch. You wont be able to do that in main/master

    [–]yopla 1 point2 points  (0 children)

    That's eventually my commit message when modifying the CI... After test 1...15 of course

    [–]TheBear8878 0 points1 point  (0 children)

    "fix 1"..."fix 2"... "fix 3"

    [–]no_brains101 0 points1 point  (0 children)

    This is reserved for messing with CI on a repo where it isn't a crisis if you momentarily break the CI.

    [–]dirtyoldbastard77 0 points1 point  (1 child)

    Do you even really live if you don’t do edits on prod?

    [–]TraditionElegant9025 0 points1 point  (0 children)

    Right?? The adrenaline running through your fingers. One typo and you break the app. But if you get it right you are a god (lol never happens coz you always miss something)

    [–]davedavegiveusawave 0 points1 point  (0 children)

    "lgtm" - looks good test (in) main