DEV Community

Cover image for Do you merge branches locally or create pull requests for personal projects?
Ben Lovy
Ben Lovy

Posted on

Do you merge branches locally or create pull requests for personal projects?

I'm not sure if this is #help. Is there a correct, universally accepted better practice? In that case, yes, help me by telling me what I should be doing.

I kind of do both. If it's a relatively small change, I'll just (squash and) merge my local work branch into my local master branch and then push to origin/master, cleaning up my local branch locally. Nice and clean.

For larger changes, or changes that take me more than a session to implement, I push to origin/<branch-name> and then open a pull request. I then use GitHub to squash, merge, and delete the work branch.

This feels a little cleaner and more organized, but it also feels a little silly to "review" and "accept" changes where I was the only person involved.

obama meme

Ben accepting his own PR, 2020

If there isn't a "one true way", please #discuss your own personal preference! Mods, feel free to de-#help me.

Photo by pine watt on Unsplash

Latest comments (41)

Collapse
 
bhupesh profile image
Bhupesh Varshney 👾

I do this a lot.
Additionally I have setup a ton of type-checker, Dynamic Testing Tools
This helps me judge my code

Collapse
 
cyberhck profile image
Nishchal Gautam

I protect my master branch, unless my ci says that changes are alright, they don't go to master

Collapse
 
mattmcadams profile image
Matthew McAdams

I agree it feels kind of silly at times but for me it’s part of learning and building a habit of using git in a “real” workflow. I also do my best to use GitHub issues on public personal projects, just so there is a public record of todo items / bugs on the off chance someone wants to use / fork the project or contribute.

I’m really obsessive over organization though so it might just be me.

Collapse
 
miteshkamat27 profile image
Mitesh Kamat

Well, I have made it a habit that even if I work on a small change I should create a pull request.It could sound silly to create a pull request where you are the only reviewer but it helps in future. You get another chance to review your code and refactor it.

Collapse
 
gablaroche profile image
Gabriel Laroche

I usually just close my eyes and push to origin/master. But seriously though, if it's a big change might make a pr.

Collapse
 
ayozebarrera profile image
Ayoze Barrera 🇮🇨

PR linked with a issue describing the change ♥️

Collapse
 
deciduously profile image
Ben Lovy

Tools only work if you use 'em!

Collapse
 
aleksandrhovhannisyan profile image
Aleksandr Hovhannisyan

I merge locally for the convenience. If the project involves other devs, then I'll obviously open a PR.

Collapse
 
deciduously profile image
Ben Lovy

gasp

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

If my project get stable enough, I work outside master to prevent breaking the master branch itself; then merge online; because web UI tools do help.

Collapse
 
ogrotten profile image
ogrotten

I use local branching very liberally. Branch, work, branch a branch, debug, merge, finish feature, merge to master, push to remote.

Most of my personal projects only have master pushed to it. Only if I'm "done for now" and haven't completed somethign will I publish the branch.

For personal projects, it's pretty rare.

Collapse
 
jhechtf profile image
Jim Burbridge

I tend to make the changes in a branch and push them up to Gitlab. I tend to have some variety of testing that goes on before I can merge the results (Linting, Unit, etc), so even though I'm paranoid and will run those locally it's nice to have a record that 'when I pushed the merge request up the tests ran fine. Not sure why they messed up now.' I do it even for my personal site most time (though i will occasionally start working on something, get two commits in and realize I forgot to make a new branch).

 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

Ben GitCraken is like this and cross platform

gitkraken.com/git-client

Thread Thread
 
deciduously profile image
Ben Lovy

Thank you!

Thread Thread
 
dwilmer profile image
Daan Wilmer • Edited

A quick overview of what I found for Linux.

Working (but not the way I want):

  • GitKraken installs, but requires a paid license to use with private repositories. Since I mainly use private Bitbucket repos, this doesn't work for me.
  • GitAhead works, but has very little emphasis on branches. As I'm using feature branches, this does not work well for me.

Not working on Linux (yet):

  • SourceTree (spent several hours to get it to work with Wine, no success yet)
  • Fork (currently working on it, not easy, might bail Doesn't support 32 bit windows, Wine and .NET 4.8 do not play nice with 64 bit)
Thread Thread
 
sanchocreativo profile image
sanchocreativo

Another thing to mention is that gitkraken is made with Electron, therefore is not very performant, at least in Linux.

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀

Arguably, it doesn't matter all that much for it's purpose. I found but kraken years back because it's electron basses and electron was new and shiny.
If performance is 2 seconds of lag and awquaurd nothingness then sure, don't use it. But also its relative to your machine, kernal and distro which is again not equal.
But yes electron takes up a decent chunk of memory on a machine with limited resources, don't run a GUI 😛. I have tested nwjs electron and other native webview based applications, electron is the worst but I still don't mind.

Collapse
 
jeikabu profile image
jeikabu

I make my own PRs. Mostly just so my workflow is always the same, use pre-commit tests and builds for other platforms, etc.

Collapse
 
donnisnoni profile image
Don Alfons Nisnoni

If the changes are big or the commits are too much, I will do PR, if it was small, I will merge. Simple as that.

Collapse
 
deciduously profile image
Ben Lovy

This looks neat - do you have a Linux recommendation? Or would this work in Wine? I used to use Magit but have de-Emacs'd and never found a replacement.