Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
comedyblissoption
Mar 15, 2006

yah that's a really dumb footgun with git

to be fair you should be able to set up force push permissions on the git server though

Adbot
ADBOT LOVES YOU

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

comedyblissoption posted:

yah that's a really dumb footgun with git

to be fair you should be able to set up force push permissions on the git server though

you can

e: https://coderwall.com/p/wo3kng/git-disable-force-push

jesus WEP
Oct 17, 2004


the f in push -f is actually short for gently caress you

MononcQc
May 29, 2007

Compare the mercurial approach to destructive updates like rebasing, where they will allow rebasing a local changeset onto a published (immutable) one, but not the opposite (which would result in duplicate commits and conflicting histories).

You can even set your config to show the phase in a graph:

code:
$ cat ~/.hgrc
[ui]
username=Elon <olmusky@musk.com>
logtemplate='[{phase}] {desc} ({node|short})\\n'
...

 $ hg log --graph
o  [public] Some bedroom description. (0a5b3d7e4e5f)
|
| @  [draft] Add a table in the kichen (bcd4d53319ec)
| |
| o  [draft] Add wall color (f9f14815935d)
|/
o  [public] We need a kitchen too. (2afbcfd2af83)
|
o  [public] First description of the throne room (898889b143fb)
You can only mutate draft histories and not public ones. There's also a 'secret' phase for the changes that are purely local:

- Changesets exchanged with the outside are public and immutable.
- Changesets committed locally are draft until exchanged with the outside.
- Phases move transparently and you don't have to track poo poo.

If you have a repo server instance that is usable for dev or a project only, you can mark it as non-publishing to keep poo poo mutable, but the moment your changeset is posted to the canonical one for the team, they could become immutable. The strictest form is always kept.

You can also mark some branches as secret so that they never get pushed by accident: hg phase --force --secret <local-commit> You can also decide to want to mark all commits that should be publishable at first by just defaulting to secret commits, but that would likely confuse the newcomers as a default config:
code:
[phases]
   new-commit=secret
Any commit marked as secret (or draft) means that all the other commits after must be in the same phase as well to remain consistent. You'd have to mark them as draft (hg phase --draft <commit-or-bookmark>) before publishing.

This whole setup basically forces you to do reasonable non-dangerous rebases if you want them. Git just lets you wreck whatever.

MononcQc fucked around with this message at 15:08 on Dec 15, 2017

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat

St Evan Echoes posted:

tfw your dipshit coworker does a push -f on a branch you’re both working on

lol if you let destructive changes happen on your repos

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat

St Evan Echoes posted:

the f in push -f is actually short for gently caress you

alias gityolo='git commit -am "DEAL WITH IT" && git push -f origin master'

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

push -f onto your fork branch is literally the policy here

you have to rebase on the integration branch before you open your pull request but after all development is done

Sapozhnik
Jan 2, 2005

Nap Ghost

CRIP EATIN BREAD posted:

alias gityolo='git commit -am "DEAL WITH IT" && git push -f origin master'

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
immutable changesets are great assuming you trust all of your coworkers to never gently caress up

Valeyard
Mar 30, 2012


Grimey Drawer

CRIP EATIN BREAD posted:

alias gityolo='git commit -am "DEAL WITH IT" && git push -f origin master'

theres at least 3 things wrong here that would get blocked by our commit hooks

* commit message without a valid JIRA identifier
* pushing to master without a pull request
* force pushing is disabled

jesus WEP
Oct 17, 2004


users shouldn’t be able to push to master imo, it should be an automated thing when a pull request completes

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

St Evan Echoes posted:

users shouldn’t be able to push to master imo, it should be an automated thing when a pull request completes and a good build of the integration branch is achieved

Valeyard
Mar 30, 2012


Grimey Drawer
alternatively, master should be whatever code you have in production at any given time. i guess it depends on your ~#!##==-- GIT FLOW --==##!#~

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

Valeyard posted:

alternatively, master should be whatever code you have in production at any given time. i guess it depends on your ~#!##==-- GIT FLOW --==##!#~

we support versions of the product going back 5 years, so those live in service branches which support generating interim fixes

CPColin
Sep 9, 2003

Big ol' smile.

Valeyard posted:

alternatively, master should be whatever code you have in production at any given time. i guess it depends on your ~#!##==-- GIT FLOW --==##!#~

I got so confused reading one of those git flow articles until I realized that it was mostly the same as my last job was doing, except there, master always had the latest code and hotfixes were made by branching off of the latest release tag, while most git flow advocates have master track the currently released version and have the separate release branch for the latest integrated stuff. I bet flows like that are a lot easier to manage when you have CI and stuff, which we didn't!

MononcQc
May 29, 2007

uncurable mlady posted:

immutable changesets are great assuming you trust all of your coworkers to never gently caress up

lol if you think people loving up have fewer chances of doing damage with a mutable history than an immutable one

tef
May 30, 2004

-> some l-system crap ->
also everyone shits themselves when someone fucks up git history

Valeyard
Mar 30, 2012


Grimey Drawer
our git history is a steaming pile of poo poo, good luck trying to figure out where a change came from lol

it means its easy to manage

since you dont have to care (y)

Valeyard
Mar 30, 2012


Grimey Drawer
ive been in current job for ugh... 2 years and 3 months since leaving uni

wondering when its time for a change

HoboMan
Nov 4, 2010

no time like the present

Valeyard
Mar 30, 2012


Grimey Drawer
im going to wait till promotion time in mid january, wont get the salary i want, and then start looking

ive been speaking to some random linkedin recruiters passively, but might ramp it up

time to start the yospos cv thunderdome

JawnV6
Jul 4, 2004

So hot ...
idk i flatten branches all the time so i don't have to pick through multiple commits to see my first shot and the testing/review changes, and that requires deleting "pushed" commits before they land in master. but the alternative workflow would be making a new branch and starting a new PR, which is a hit but a minor one

Valeyard
Mar 30, 2012


Grimey Drawer

JawnV6 posted:

idk i flatten branches all the time so i don't have to pick through multiple commits to see my first shot and the testing/review changes, and that requires deleting "pushed" commits before they land in master. but the alternative workflow would be making a new branch and starting a new PR, which is a hit but a minor one

you have feature branch

you finish your change

raise pull request

code gets reviewed

you make changes to fix review comments (lol as if) in same branch

pull request gets approved and you hit "merge + squash" option

1 commit makes it into master/dvelop/whatever branch youre merging the change into

JawnV6
Jul 4, 2004

So hot ...

Valeyard posted:

pull request gets approved and you hit "merge + squash" option
nah

jesus WEP
Oct 17, 2004


our workflow is merge + squash and i don’t like it! esp when we have awful oversized tickets that have 3 weeks of solid dev work in them. way too much to squash into 1 commit

Sapozhnik
Jan 2, 2005

Nap Ghost
learn to interactive rebase u scrubs

Mao Zedong Thot
Oct 16, 2008


People obsessed with commit history janitoring are bad people. Like make reasonable commits, fix-up/rebase interactive extra garbage stash/wip commits, and move on.

Valeyard
Mar 30, 2012


Grimey Drawer

St Evan Echoes posted:

oversized tickets

theres your problem. i hate this. i hate opening a pull request and having to review some loving massive change (that could have been split up into different branches probably)

if it couldnt, then at least raise the PR at some point and let someone review it as you go, rather than letting it build up to some big bang

Sapozhnik
Jan 2, 2005

Nap Ghost
https://twitter.com/Crypto_Lizard/status/941686238213369856

see you in six hours motherfuckers

pangstrom
Jan 25, 2003

Wedge Regret
sounds like maybe git's good if you git gud

Valeyard
Mar 30, 2012


Grimey Drawer
i love when teammates screenshare their screen to me, and i can see they have 20+ seperate git checkouts, one for each branch they use

Notorious b.s.d.
Jan 25, 2003

by Reene

Valeyard posted:

i love when teammates screenshare their screen to me, and i can see they have 20+ seperate git checkouts, one for each branch they use

if they found a workflow that avoids obliterating their works in progress, that's good, ok

better that they look dumb on a screenshare than that they lose hours of time because they didn't fully understand the consequences of `git reset` in a particular context

Sapozhnik
Jan 2, 2005

Nap Ghost
yeah git-reset is probably one of the worst-designed human-computer interaction constructs since for-else

MononcQc
May 29, 2007

deleting a remote tag, favorite git pet peeve

Valeyard
Mar 30, 2012


Grimey Drawer

Notorious b.s.d. posted:

if they found a workflow that avoids obliterating their works in progress, that's good, ok

better that they look dumb on a screenshare than that they lose hours of time because they didn't fully understand the consequences of `git reset` in a particular context

i get what you mean

but when they refuse to learn how git works, and just sledgehammer approach use it the same way they would subversion, this leads to problems with people not understanding what they are doing or why they are doing it

Valeyard
Mar 30, 2012


Grimey Drawer
people leaving merge conflict chevrons in their commits is ownage

people actually approving this during code """""""""""""reviews"""""""""""" is even more ownage

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

pangstrom posted:

sounds like maybe git's good if you git gud

it’s not tho, which is a real shame for this joke

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

Valeyard posted:

people leaving merge conflict chevrons in their commits is ownage

people actually approving this during code """""""""""""reviews"""""""""""" is even more ownage

git: 'gud' is not a git command. See 'git --help'.

Did you mean this?
gui

Eleeleth
Jun 21, 2009

Damn, that is one suave eel.

carry on then posted:

git: 'gud' is not a git command. See 'git --help'.

Did you mean this?
gui

git config --global alias.gud 'push -f'

Adbot
ADBOT LOVES YOU

minato
Jun 7, 2004

cutty cain't hang, say 7-up.
Taco Defender
The git docs are super clear, I don't know why this is so difficult.
https://git-man-page-generator.lokaltog.net/

  • Locked thread