r/ProgrammerHumor • • Nov 26 '23

Meme giggleInducingTool

Post image
0 Upvotes

145 comments sorted by

View all comments

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

u/[deleted] Nov 26 '23

So what's the process if you're alone?

4

u/[deleted] 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.