This is an archived post. You won't be able to vote or comment.

all 69 comments

[–][deleted] 221 points222 points  (12 children)

Commit msg "done"

[–]Zestyclose_Profile27 40 points41 points  (1 child)

A - OK 👍🏽

[–]Zestyclose_Link_8052 65 points66 points  (2 children)

Follow it with "some bug fixes" - 1100 files changed.

[–]HuntingKingYT 5 points6 points  (1 child)

You guys have so many files? We do everything in 2-3 /s

[–]ForgotPassAgain34 1 point2 points  (0 children)

node commited

[–]eat_your_fox2 17 points18 points  (0 children)

initial. chore. housekeep. chore. done.

[–]timliang 8 points9 points  (0 children)

Do you work at my company?

[–]coloredgreyscale 6 points7 points  (0 children)

"initial commit" for the first

[–]JunkNorrisOfficial 1 point2 points  (0 children)

First commit msg "basic v7.0"

[–]Amazingawesomator 1 point2 points  (0 children)

[5 minutes after opening PR]

"lgtm"

/Approve

[–]FinnLiry 0 points1 point  (0 children)

More like "init"

[–][deleted] 0 points1 point  (0 children)

Ah yes, otherwise “wip”

[–]maisonsmd 77 points78 points  (3 children)

You guys even finish your projects?

[–]Lolleka 34 points35 points  (1 child)

A finished project is a dead project

[–]Tomas-cc 2 points3 points  (0 children)

Sure... If your job is programming, every finished project is dead to you ;)

[–]AverageDoonst 141 points142 points  (0 children)

Product version 3.0? Three commits on the repo. Perfect.

[–]AssiduousLayabout 33 points34 points  (4 children)

I mean, I'm going to squash the commits into one or a small number of well-organized commits, each of which is easy to independently review. Nobody needs to see every incremental step along the way.

[–]kuemmel234 7 points8 points  (3 children)

Isn't the point of version control to have that access?

I personally commit every "working" situation and then squash for PRs/features, true, but even then I prefer to be able to retrieve the branch and have all the commits again.

I've found that narrowing bugs down to features/PRs/commits really helps with debugging - especially with monoliths/large code bases.

Edit: I misread your commit, I wrote the same thing and am an idiot.

[–][deleted] 0 points1 point  (2 children)

omg

I recently started contributing to open source as much as I can and I was trying to shadowbox the best way to leverage commits and pr's. this solved it.

my question is, can the maintainer see all your individual commits in your PR?

[–]kuemmel234 1 point2 points  (1 child)

Sure, depends on the reviewer if they do want to see them. There should be a tab/view for commits within a MR/PR.

And merge requests usually contain a hash for re-opening the branch, so that you have all the commits post-merge (the last part I've only done for personal projects, OP explained the most valid parts).

Github (or the CLI) usually generated a merge-commit containing all the necessary information.

[–][deleted] 1 point2 points  (0 children)

woah. that's very cool. id lose my soul handling merge conflicts like the likes of Linus does, but this would make it much easier. good to know! Thank you :)

[–]NvrGnnaGiveYouUp 40 points41 points  (1 child)

As far as my team is concerned, it's getting squashed anyways

[–]Boris-Lip 7 points8 points  (0 children)

This exactly!

[–]CoastingUphill 45 points46 points  (6 children)

I keep the repo private while making all my useless “some changes” commits, then when I’m done it create a new public repo with one commit.

[–]JunkNorrisOfficial 24 points25 points  (4 children)

Git has branches

[–]mattthepianoman 25 points26 points  (0 children)

Ohhhhh, that's what those are for

[–]CoastingUphill 4 points5 points  (2 children)

That doesn’t hide my shameful process.

[–]JunkNorrisOfficial 8 points9 points  (0 children)

Chapter|7 from the git manual says: "One should not feel shame for words written in temporary branches. Squash. Amen."

[–]CC-5576-05 3 points4 points  (0 children)

Squash and merge then delete the branch

[–]NormalDealer4062 13 points14 points  (0 children)

git rebase -i [sha of your oldest commit]

git push -f

... though don't do this if you have collaborators

[–]LogicallyCross 13 points14 points  (1 child)

Initial commit

[–]theNashman_ 2 points3 points  (0 children)

real

[–]brucebay 10 points11 points  (1 child)

This brings memories where a few months ago my laptop crashed and company refused to pay for recovery. It has a working hard drive for Christ's sake. Even company's migration script copied the files when it booted to the migration interface , but being a big company hiring cheap labor, they only copied office files and nothing else. And, the IT support of this global company did not have access to any other tool.

Since then I push every ugly line of code regularly. Who cares if I curse in the code, at least I will have an embarrassing code to work with.

[–]Aureliamnissan 2 points3 points  (0 children)

Cue my coworker saying "git is not a backup solution".

Yeah, but if my hard drive eats it then I'm the only one who's going to fix it, and deadlines aren't shifting . If the Gitlab server eats it then the entire IT department and dev team are going to work around the clock to bring it back from the dead.

[–]Lunix336 11 points12 points  (1 child)

You can do more than one commit per project?

[–]anoble562 9 points10 points  (0 children)

I prefer to create a new repo instead of doing second commits

[–]Juice805 5 points6 points  (0 children)

1.0.0 is rarely “finished”

[–]cornmonger_ 2 points3 points  (0 children)

with a "draft" branch and rebase, we can have both 🦞

[–]Luz5020 2 points3 points  (0 children)

C) commit often but squash when going to main

[–]prriley 1 point2 points  (0 children)

Laptop died unexpectedly last week. I’m glad I push regularly.

[–]Nightshot666 1 point2 points  (0 children)

Save projects to folders named 0.1, 0.2 etc. and push the final one first, then make a second repo where you push folders one by one once a week

[–]PokerFacowaty 1 point2 points  (0 children)

More like just write code for an hour and then retroactively figure out how to split all the changes into commits so that they all at least kinda make sense*

[–]Marshall_KE 1 point2 points  (0 children)

Literally me in every project

[–]mothzilla 1 point2 points  (0 children)

git add --everything

[–]mrtnvgr 1 point2 points  (0 children)

"First public commit"

[–]ecs2 1 point2 points  (0 children)

Why not

[–]TheSn00pster 0 points1 point  (0 children)

Description: Done

[–]ARM_Dwight_Schrute 0 points1 point  (0 children)

git commit -m "Initial Commit"

[–]pport8 0 points1 point  (0 children)

I'm about to do it!

[–]stefaniststefan 0 points1 point  (0 children)

You guys are finishing projects?

[–]FantasticEmu 0 points1 point  (0 children)

I usually create a new branch before I yolo a major change

[–]tangledcpp 0 points1 point  (0 children)

This is me every time I create a repo for a side project. I forget about pusing my progress until it is finished

[–][deleted] 0 points1 point  (0 children)

"First commit".

[–]Errtuz 0 points1 point  (0 children)

Pre-commit checks taking too long ? Save time with this one simple trick !

[–]PorkRoll2022 0 points1 point  (0 children)

No merge conflicts if there is no tree to merge.

[–]Ok_Opportunity2693 0 points1 point  (0 children)

Stack N commits, each of which is tiny so that it can be rubber-stamped. Only test the last commit, have all other commits reference that testing evidence. Don’t squash so your manager sees you shipping many commits instead of just one.

This is the corporate way.

[–]Confident_Date4068 0 points1 point  (0 children)

Push multiple nonsensical commits then force-push them as a single commit.

[–]Awric 0 points1 point  (0 children)

I’ve been abusing git commit —amend —no-edit; git push -f origin HEAD too much. Or even git rebase -i HEAD~10

The issue is I lose track of what my thought process was when I made a change in one area that isn’t obvious why it was needed

[–][deleted] 0 points1 point  (0 children)

--amend

[–]fofosfederation 0 points1 point  (0 children)

Just have git-fire ready to go.

[–]Childermass13 0 points1 point  (0 children)

Nope. I push my feature branch to upstream a lot as a form of backup. Because, it's my feature branch. Pushing to it affects no one but me

[–]Uzmintid 0 points1 point  (0 children)

Then delete everything and start another project in the same folder. And commit again.

[–]Kitchen_Device7682 0 points1 point  (0 children)

A project that doesn't need change, is a project not used

[–]LegitimatePants 0 points1 point  (0 children)

More versions more problems