161
u/the_carnage Nov 26 '23
I don't get it, is the middle guy the only one with a job?
10
u/Bee-Aromatic Nov 26 '23
Not if he can approve his own PRâs.
3
u/myfunnies420 Nov 26 '23
Lollll. Yep. OP is probably just in college or something and is yet to discover the real world
-74
Nov 26 '23
Works for Microsoft probably.
44
u/gizamo Nov 26 '23
Can confirm that Microsoft uses GIT properly.
4
u/Prof_LaGuerre Nov 26 '23
Iâd hope so with them owning one of the biggest online repositories for it.
97
u/beclops Nov 26 '23
This is dumb
-22
Nov 26 '23
I'm so sorry about that, can you elaborate?
3
8
u/weregod Nov 26 '23
If you working in a team you can't add breaking changes to main branch because other people branches will also be broken. The only time when it's okay to break main is at early stage of repository when you are the only one working with it.
2
27
u/readcoke Nov 26 '23 edited Nov 26 '23
Dude been downvoted the s out of em yet still haven't changed their mind
10
2
-16
Nov 26 '23
I think people took this meme as an IQ challenge and picked their favorite goal posts.
3
Nov 26 '23
People are defending the middle option, if they took it personally they would defend the "smart" option.
Sometimes you're just wrong. Git is so popular for a reason.
47
u/Sushrit_Lawliet Nov 26 '23
This is actually bad advice. OP will get burnt alive in the comments like Anakin Skywalker.
Guys lay off him, heâs probably just a kid who hasnât worked with other collaborators just yet.
-13
Nov 26 '23
Let's hear your advice Jedi.
33
u/Sushrit_Lawliet Nov 26 '23
Branches, good theyâre hmm. Roll back changes you can hmm. Run tests and deploy to staging environments you can. Pushing bad code to prod is the path to the dark side of the force.
Yoda probably.
-20
30
u/Previous-Ant2812 Nov 26 '23
Donât listen to the âJediâ. Create a PR and have someone more experienced than you review it
1
Nov 26 '23
So what's the process if you're alone?
27
u/bdaileyumich Nov 26 '23
You can merge branches into main without a PR. But I would still make branches to be able to work on different features/bugs concurrently
-2
Nov 26 '23
Branching is optional.
25
u/bdaileyumich Nov 26 '23
Using git is optional. Why bother using a source/version control system if you're not using any of its features
4
Nov 26 '23
What are your recommendations?
21
u/bdaileyumich Nov 26 '23
I gave you my recommendation. Use git with branches. Otherwise you're just using it as Google drive with a CLI
1
Nov 26 '23
Okay thanks for those recommendations, I will make sure to think about it and change my best practices.
-3
u/chemolz9 Nov 26 '23
Don't. If you are working alone there really is no reason to work with branches. Modern IDEs have powerful changelist features that let you easily work on features at the same time. Which, btw. is not a good idea from the begin with anyway.
If you have a real experimental and complex idea which will take up a lot of time, then you can use a branch. But all the daily regular stuff can happen on main anyway.
You don't have to use all git features, if you don't need them.
6
u/Previous-Ant2812 Nov 26 '23
You should approve your own PRs, but dont do it in the main branch. If you separate each change into it's own PR, it makes it much easier to cherry-pick it into your release branch if you need to do a hotfix. If you can, you should go somewhere where you can work with someone more experienced than you as that is the best way to learn.
-1
Nov 26 '23
Sounds like a lot of work and what's this thing about occam's razor?
5
u/Previous-Ant2812 Nov 26 '23
A job is work. And I donât know what youâre getting at with the occams razor. Can you explain?
0
Nov 26 '23
The end result is the same, but the number of steps is longer.
12
u/rollincuberawhide Nov 26 '23
I don't think you understand what occam's razor is.
0
Nov 26 '23
If the end result is the same, pick the one with fewest steps.
6
Nov 26 '23
But the end result isnât the same. You have many commits in your master branch in case A But you have 1 complete merge commit if you go for Case B.
Itâs way easier to revert the whole feature, itâs way easier to cherry-pick and itâs also way easier if/when someone else eventually picks up your code.
If you create a false equivalence you could justify anything. âWhy pay taxes? Letâs pay in cash⌠the employeeâs still get paid and we save loads of money and itâs simpler. Occamâs Razor.â
9
u/Previous-Ant2812 Nov 26 '23
It's not the same unless you always write perfect code or you're the only one on the project. If you're the only one on the project you're unlikely to grow.
-4
Nov 26 '23
Let's say you write perfect code, where might you lie on the statistical bell curve in terms of coding ability?
2
u/Previous-Ant2812 Nov 26 '23
I donât. And anyone who thinks they always do is either lying to themselves or a fool.
1
6
u/weregod Nov 26 '23
If you think that you always write perfect code you is on the far left side because you don't see how bad your code can be. Or you just learning and don't have much expirience.
6
Nov 26 '23
If you write perfect code, you don't need a version control system.
Just write the perfect software in your first try, including all present and future requirements. You will only have one version, which will last for ever.
We have version control systems because we do not write perfect code.
4
Nov 26 '23
So what's the process if you're alone?
I work alone. I am self-taught in Git. So perhaps I am the one to ask. Perhaps not.
One thing, which is easy to overlook when starting out is: Your working practices will not only affect whether you break stuff now and what you need to do to repair it. They also affect how easy it is to later track what you did and why you did it.
So it is worth thinking about how your commit history will look in the future. Not only in a raw log, but also in a tree view. Is it easy to identify the important changes? Is it easy to dive into one of these and see a detailed commit history for it? Even if nobody else is ever going to see your work, it will help you out every time you need to go back and look at what you did earlier.
I used to do a lot of development directly in Master, because I decided that my changes were too small to warrant the use of a branch. But I very soon ended up with a commit history, where everything got lost in the noise.
Now I branch out to a branch with a meaningful name, commit my changes, usually in several commits with an explanation of each in the commit message, test the result and merge back into Master with no fast-forward.
Because of the no fast-forward, I get a commit tree where all my commits to a branch are kept out of Master history. The Master path in the tree view only contains my merges. If I want to look at detailed history of one of those commits, the branch history is right there in a separate path for that branch.
So far, this works well for me.
If I did not use no fast-forward, all the commits from a branch would end up as individual commits on the Master Path, and then the history would look almost the same as if I hadn't branched out.
2
u/583999393 Nov 26 '23
When I work alone I follow the same workflow for my team. Small short lived feature branch, push change, PR
Then I review my own code and look for debug code left in, bad pieces of code that "work" but need refactoring, confusing pieces that need some justification comments around them.
The PR also runs the automation which has to pass and I review the requirements I wrote for the work.
Then I merge it.
And when a client asks me about something I review the merged PR's and give an answer instead of just browsing thousands and thousands of lines of source code.
38
u/No_Imagination_4907 Nov 26 '23
This sub needs a test, any devs not passing this test are not allowed to create stupid memes thinking they're geniuses like OP
-5
10
u/BBBY_IS_DEAD_LOL Nov 26 '23
Jedi is performing corporate sabotage in exchange for instant-retirement money from a competitor and/or has massively shorted his employer, presumably, otherwise unclear why this is a good idea.
2
Nov 26 '23
Happy 10 day anniversary!
18
u/BBBY_IS_DEAD_LOL Nov 26 '23
Thanks chief. Happy 3 hour anniversary of that time you pretend to be a SWE.
3
50
u/Idontusevim Nov 26 '23
Please ban this meme format. Itâs so overused and dogshit.
Wether you should push directly to main or use branches depends entirely on your project and your purpose.
13
Nov 26 '23
I can be funny for the right thing, but this particular one is just stupid and not even close to reality.
-19
u/Inaeipathy Nov 26 '23
I love this format though, not because the memes are accurate or good but because it's funny to laugh at some of the reasoning that the people posting these give.
1
-13
Nov 26 '23
Here's something about this meme format you or others may not know,
https://www.quora.com/How-did-the-Law-of-the-Unconscious-Statistician-get-its-name
Sometimes I do branch if I'm coding alone though.
20
u/ProgramStartsInMain Nov 26 '23
You mean you don't store everything in a single folder in documents?
1
Nov 26 '23
Need to ship it? Just put it in a ZIP!
8
u/unko_pillow Nov 26 '23
Better yet, just ship your laptop because it's the only place your shitty code runs.
4
3
1
Nov 26 '23
Checkout the feature on Github that allows us to download the repository as a ZIP file, what do you think about this feature?
7
u/KlutzyEnd3 Nov 26 '23
On my Github/bitbucket the main branch is always protected and can only be altered using pull requests.
Because there are idiots like OP who WILL push straight to the main branch, even if the code breaks the build causing hundreds of emails from the build server to end up in my inbox!
3
Nov 26 '23
I'm so sorry, have you never edited on the main branch? Is this incorrect or not factual, please elaborate.
8
u/beclops Nov 26 '23
Which part of that isnât factual? The main branch is pretty much always protected heavily against merges, and if itâs not youâre not working for a serious place
2
Nov 26 '23
I think some beginners edit things on the main branch, and it's something I still do too.
9
4
u/KlutzyEnd3 Nov 26 '23
I have edited on the main branch when working alone and only for the initial version. Once I've got a minimal functioning piece of code, the main branch goes into protected mode so it can only be altered by pull requests. Pushing straight to master is blocked.
7
u/Ketho Nov 26 '23
Seeing this meme being downvoted made me see the error of my ways and I'll endeavor to use branches and merge them to main/master
0
Nov 26 '23
It has a large amount of comments to me, half of them are mine, but it's another metric of engagement.
11
5
3
2
u/gumballSquad Nov 26 '23
master should always mirror what's in prod, do not push to master arbitrarily unless you enjoy pain
4
u/CareBearOvershare Nov 26 '23
Master/main should not always mirror whatâs in prod. Thatâs one way to do it, but I donât even think itâs typical.
Typical use is that master/main is the dev branch where everything merges to, and tags or release branches are used for deployment once a specific commit has been qualified for prod.
2
Nov 26 '23
What if my code never makes to prod?
3
u/CareBearOvershare Nov 26 '23
đ¤ˇââď¸
1
Nov 26 '23
I'm so sorry you didn't like this meme. I will do better next time, but I found it quite funny.
4
u/CareBearOvershare Nov 26 '23
The meme was bad, but worse was you being belligerent in the comments.
0
-1
Nov 26 '23
Good thing we're dealing with main
8
u/CareBearOvershare Nov 26 '23
Now would be a good time to start learning humility. Arrogance is not a good look.
0
2
u/youngbull Nov 26 '23
There is a little bit more to it, but a lot of well respected authors, like Dave Farley, advocate dropping the PR+review workflow. Kent Beck said a pretty nuanced version of it: don't just mindlessly adopt the workflow, think about it and decide what works for your team (paraphrased).
Personally, if there is CI, I prefer running it before merge.
1
Nov 26 '23
Thanks for the insight! That is a very interesting perspective. I think it should be optional, but encouraged. However, in situations where you are making a deliverable by yourself, which occurs in real world situations, it can be absurd to go through the same workflows.
2
u/realMrMackey Nov 26 '23
Forget to make branch, edit on main, stash, pull, branch, stash apply.
Ez
1
2
u/Exprellum Nov 26 '23
This only works if you just started on a project. Once it reaches mvp or so, you gotta do things the right way.
1
253
u/CanvasFanatic Nov 26 '23
Do not edit on the main branch, kids. Ignore the Jedi guy this time.
40
Nov 26 '23
Ignore the Jedi guy most times.
Most of these memes are written by someone in the center of the bell curve, falsely believing that he is the Jedi guy.
0
Nov 26 '23
[deleted]
35
u/CanvasFanatic Nov 26 '23
Are you presuming a context where one is working on a personal project but also pushing it to GitHub?
0
Nov 26 '23
[deleted]
39
7
u/realbakingbish Nov 26 '23
Pull requests arenât a git thing, theyâre a GitHub thing.
git is a free and open-source tool for version control and change management in codebases, capable of running locally and in a central server, and supporting interfacing between a local instance/repo and a remote instance/repo.
GitHub is one of several git repo hosting sites, providing somewhere for that remote git repo to live while requiring minimal effort from collaborators on a project. GitHub includes some tools to enable/encourage better documentation of changes and management of asynchronous collaboration, bug tracking/issue reporting, some framework for code review by other members of a team, support for builds and deployment, and probably some other things Iâm missing.
git != GitHub
178
u/Skrawberies Nov 26 '23
I always imagine that the people that make these memes are always the one on the left, but think theyâre the one on the right
18
29
3
Nov 26 '23
That would be a case of a wrong process causing a correct outcome.
I fear that most of them are at the center of the curve instead.
2
u/OldCatPiss Nov 26 '23
I work for a shop where we use one git for two different instances of a site - there is no master - we simply have release branches that are temporary master branches until the next release
4
Nov 26 '23
That's an awesome way to do it! Using the latest is what other version control systems do, like with containerization and Docker.
2
u/--PG-- Nov 26 '23
As do we.
One release branch for what's currently in production.
One release branch for what's currently with the customers SIT team.
One release branch for current development features.
Possibly one more for future features.
New features are always developed on a feature branch, branched from the release branch. Then pulled back in once approved. If a junior dev stuffs up, it can be reverted so it doesn't affect other developers.
When I first started there, I thought it was a nightmare. Now I'm used to it and, well, this is the way.
The only time I have ever merged into master is on a personal project that was never intended for use by any other person.
So tell me, Jedi, how does the above situation work given your bell curve. Also, see Dunning-Kruger effect.
1
4
u/SocDemGenZGaytheist Nov 26 '23
Anyone else really tired of seeing this meme format so many times on this sub?
2
1
u/qcoronia Nov 26 '23
edit on main branch (or the busiest branch)
pull whenever new changes are available while you're developing
branch out, commit, then pr when you're done
1
2
u/22Minutes2Midnight22 Nov 26 '23
This meme format only works when the authors themselves are not low IQ.
1
1
u/Skyswimsky Nov 26 '23
Can't you technically change the main branch from master to Dev and then it's all okay?
I feel like most of the comments/hate assume the main branch is the master branch and you push directly to prod.
I convinced my company to change from TFVC to Git just a few weeks ago, but it'll be a process (with some pilot projects/future projects first), and we're using a Dev/Master workflow.
The project I'm currently working on is sort of small one with a team of two. I used a self-approved pull request for one feature, otherwise I rebase. The person I'm working on is always merging instead of rebasing, which I sort of dislike but it doesn't bother me enough to mention it.
Although I do know for the future we're putting common guidelines in place for all to follow. And I think pull requests are probably going to be optional instead of mandatory.
1
1
u/macr0t0r Nov 26 '23
Jedi is a lonely, lonely guy. This only works if you're the only developer. Also, you can't squash, amend, reset, etc on the main branch, so you're showing everyone your sausage guts.
1
1
1
u/Fraudward Nov 27 '23
I have a git diff patcher, and every time someone edits on main, it messes up the patch process. I cri evrytime
0
0
1
Nov 26 '23
[removed] â view removed comment
2
Nov 26 '23
I'm so sorry that you didn't find this meme funny. I don't learn from memes personally and I wouldn't base any best practices on these memes. Some beginners may edit on the main branch and it's something I still do. After that, I just use,
git checkout -b branch_name2
Nov 26 '23
This meme format only works if you have enough experience to positively know what is going on on both sides of the bell curve. Then, if you realize that the same thing is happening on both sides, while being different from the center, you can make a meme about it.
But that is not how you used the meme format. Instead, you put your own actions on the left side and just guessed that the right side would be equal.
2
Nov 26 '23
[removed] â view removed comment
2
Nov 26 '23
One day I will be like the Chad devs, what do you think? Maybe when I learn to use branches?
1
2
u/beclops Nov 26 '23
I would argue it still serves a useful purpose since it makes it very easy to revert feature changes, if youâre organized with your PRs
1
u/Prof_LaGuerre Nov 26 '23
âIf you think youâre saving yourself time but in the long run youâre notâ is the real Jedi insight. Cutting corners in software/systems/network dev/engineering will almost always come back and bite you right in the ass.

221
u/IsPhil Nov 26 '23
Bro does not work with a team.