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.
 
  • Post
  • Reply
The Fool
Oct 16, 2003


Brain Candy posted:

no, 'Initial Commit' is not a good commit message

it's fine if the contents are just .gitignore


maybe if it's just the results of a scaffolding tool

but not if there's been any amount of work done

Adbot
ADBOT LOVES YOU

CPColin
Sep 9, 2003

Big ol' smile.

brand engager posted:

I think swift left :? out entirely but they have this which is pretty great
code:
func thing(numberMaybe: Int?) {
    if let number = numberMaybe {
    //number is Int and in scope here
    }
}

func otherThing(numberMaybe: Int?) {
    guard let number = numberMaybe else {
    return //have to return or throw in one of these blocks
    }
    //number is in scope for rest of function as Int
}
hope kotlin steals that because afaik the closest it has is
code:
fun thing(numberMaybe: Int?) {
    numberMaybe?.let {
    //non-optional value is bound as 'it' in this block
   }
}

This works:
code:
    fun thing(maybeInt: Int?) {
        if (maybeInt == null) {
            return
        }

        println(maybeInt * 2)
    }

raminasi
Jan 25, 2005

a last drink with no ice

Brain Candy posted:

no, 'Initial Commit' is not a good commit message

is it the initial commit?

xtal
Jan 9, 2011

by Fluffdaddy

raminasi posted:

is it the initial commit?

Not unless it has --allow-empty

Brain Candy
May 18, 2006

raminasi posted:

is it the initial commit?

that's true, at least

The Fool posted:

but not if there's been any amount of work done

but also this is true

i was told of a repo with good commits and found one riddled with commits like 'changed the button'

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



my most recent couple of projects has an "initial skeleton commit" that is stuff like readme, license, etc

Glorgnole
Oct 23, 2012

Brain Candy posted:

no, 'Initial Commit' is not a good commit message

git commit -m "pity bump"

Achmed Jones
Oct 16, 2004



Carthag Tuek posted:

my most recent couple of projects has an "initial skeleton commit" that is stuff like readme, license, etc

yeah, same. I've also done plain "initial commit" where something was developed outside of VC and I'm basically importing an already-functioning bit of config, software, etc.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Achmed Jones posted:

yeah, same. I've also done plain "initial commit" where something was developed outside of VC and I'm basically importing an already-functioning bit of config, software, etc.

yeah thats fine imo, just put some further info in the commit body about where it came from

Xarn
Jun 26, 2015
"Import code from source safe"

distortion park
Apr 25, 2011


My commits definitely don't meet the terrible programming thread bar

jesus WEP
Oct 17, 2004


i use initial commit all the time but like, it gets squashed long before i put it somewhere anyone else would see it

Soricidus
Oct 20, 2010
freedom-hating statist shill
wip
wip
stuff
oops
fix bug maybe
really fix
ok fixed this time
add test
fix test
initial commit

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof
i typically expect the commit message to tell me what changed since the last commit, so idgaf what the first commit message is. might as well be blank

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
added * to .gitignore - your welcome

Soricidus
Oct 20, 2010
freedom-hating statist shill

DaTroof posted:

i typically expect the commit message to tell me what changed since the last commit,

you must be disappointed a lot

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
"initial commit" is fine because the README of your project at that point serves as a detailed "commit message" describing what's going on

DaTroof
Nov 16, 2000

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

Soricidus posted:

you must be disappointed a lot

well...yeah

also

Symbolic Butt posted:

"initial commit" is fine because the README of your project at that point serves as a detailed "commit message" describing what's going on


Soricidus posted:

you must be disappointed a lot

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.


I never squash my commits

this would be fine if I didn't constantly gently caress up and do this

Soricidus posted:

wip
wip
stuff
oops
fix bug maybe
really fix
ok fixed this time
add test
fix test
initial commit

pretty sure I'm the only person that actually looks at the commit history tho so at least I'm only ruining my own life

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



i obsessively reorder & fixup before pushing

also our senior developer does merge pulls instead of rebasing and i hate it

Brain Candy
May 18, 2006

Carthag Tuek posted:

i obsessively reorder & fixup before pushing

also our senior developer does merge pulls instead of rebasing and i hate it

merging is acceptable on your main dev branch because then I can revert all of your broken feature at once. hopefully the merge commit tells gives me context for the overall batch of commits

if you merge on your feature branch you are either a childe or monster

gonadic io
Feb 16, 2011

>>=
Squash rebase is the only way to fly. I don't give a gently caress about your branch commits

The Leck
Feb 27, 2001

gonadic io posted:

Squash rebase is the only way to fly. I don't give a gently caress about your branch commits
especially when you've already squashed everything to one commit on your branch anyway. there's no new information!

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Brain Candy posted:

merging is acceptable on your main dev branch because then I can revert all of your broken feature at once. hopefully the merge commit tells gives me context for the overall batch of commits

if you merge on your feature branch you are either a childe or monster

i mean when he wants to push but cant because he isnt up to date, he merges instead of just pulling my poo poo and rebasing his poo poo on top

the merge commit that creates is worthless

xtal
Jan 9, 2011

by Fluffdaddy

Carthag Tuek posted:

i mean when he wants to push but cant because he isnt up to date, he merges instead of just pulling my poo poo and rebasing his poo poo on top

the merge commit that creates is worthless

Git novices do that because its the default behavior of git pull. Tell them to set the config option to rebase on pull and your problems will be solved

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



but hes the senior dev :negative:

jesus WEP
Oct 17, 2004


Carthag Tuek posted:

but hes the senior dev :negative:
that does not have anything to do with being a git novice

raminasi
Jan 25, 2005

a last drink with no ice
merge pulls should not exist and they definitely shouldn’t be the default pull and they definitely definitely shouldn’t get suggested to users when a push fails. pull should be a special snowflake alias that lazy users set up. i hate pull so much.

Twerk from Home
Jan 17, 2009

This avatar brought to you by the 'save our dead gay forums' foundation.
What does it matter as long as you're squashing features into a single commit before merging them into master?

MononcQc
May 29, 2007

I use merge commits to generate change logs with small scripts like

Sh code:
#!/usr/bin/env sh

if [ -z $1 ]
then
    echo "usage: $0 <tag> [pull-request-url]"
    exit 0
fi
export url=${2:-"https://github.com/USER/REPO/pull/"}

git log --merges --pretty=medium $1..HEAD | \
awk -v url=$url '
    # first line of a merge commit entry
    /^commit / {mode="new"}

    # merge commit default message
    mode=="new" && / +Merge pull request/ {
        page_id=substr($4, 2, length($4)-1);
        mode="started";
        next;
    }

    # line of content including title
    mode=="started" && /    [^ ]+/ {
        print "- [" substr($0, 5) "](" url page_id ")"; mode="done"
    }'
it works very well and I have made variations for various places.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



jesus WEP posted:

that does not have anything to do with being a git novice

guess i shouldve said "but im the junior dev"

i dont wanna deal with any of it, im just annoyed ugh

Twerk from Home
Jan 17, 2009

This avatar brought to you by the 'save our dead gay forums' foundation.

Carthag Tuek posted:

guess i shouldve said "but im the junior dev"

i dont wanna deal with any of it, im just annoyed ugh

Nobody gives a poo poo if you're junior, make a case for actual improvements that could be made by making changes and people will listen

Brain Candy
May 18, 2006

Twerk from Home posted:

What does it matter as long as you're squashing features into a single commit before merging them into master?

sometimes multiple commits for a thing is okay, since you have prereqs for your new stuff

if you mix refactoring existing into your new stuff i will hate you. it's a small hate but yeah I will

vanity slug
Jul 20, 2010

atomic commits or i go nuclear

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Twerk from Home posted:

What does it matter as long as you're squashing features into a single commit before merging them into master?

don't loving do this because the person who has to debug an issue in production at 3am and needs to git bisect to do it will want to murder you for mashing ~10,000 (or even 100) loc changed into a single commit

keep your commits atomic, well described, and logically distinct regardless of how many you make

Twerk from Home
Jan 17, 2009

This avatar brought to you by the 'save our dead gay forums' foundation.

Blinkz0rz posted:

don't loving do this because the person who has to debug an issue in production at 3am and needs to git bisect to do it will want to murder you for mashing ~10,000 (or even 100) loc changed into a single commit

keep your commits atomic, well described, and logically distinct regardless of how many you make

does this work in monorepos with hundreds of engineers in them?

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Twerk from Home posted:

does this work in monorepos with hundreds of engineers in them?

Blinkz0rz posted:

don't loving do this

Twerk from Home
Jan 17, 2009

This avatar brought to you by the 'save our dead gay forums' foundation.
this git repo is less than 3 years old

raminasi
Jan 25, 2005

a last drink with no ice
the problem i’m currently running into at work is that we effectively require every commit to master to go through (overloaded) manual qa, which means separating your preparatory refactoring from your logic changes can double to triple your time to ship because you wait for them. so we all just mash everything together, because that’s within our power, and tripling our qa headcount or improving our test infrastructure enough to convince qa to trust us isn’t.

Adbot
ADBOT LOVES YOU

Sapozhnik
Jan 2, 2005

Nap Ghost
I interactive-rebase my work constantly and rebase on top of mainline.

I have never worked on a project with anybody else who does this but just because everybody around me regularly smears themselves in their own poo poo doesn't mean I should do likewise

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply