LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-07-2012, 03:31 PM   #1
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 20; Arch; Kubuntu; Debian
Posts: 711

Rep: Reputation: 31
git branching on 1 person project - advantages?


I'm using git for my various home programming projects. I love the idea of version control and how much simpler it is to roll back to a previous version. I was going over advanced git commands and read about branching. I completely understand how that's useful if there's more than one person working on a project, but are there any benefits to branching if I'm the only person working on a project?
 
Old 02-07-2012, 03:40 PM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 208Reputation: 208Reputation: 208
Sure, I do this sometimes.

For example, I was writing some driver code for an input sensor. At a certain point, I wanted to move from interrupt-driven to a polling model. So before I went and started hacking away my working solution, I made a branch polling, and proceeded. Then, I could easily checkout the interrupt (well, main) branch if I needed a quick reference, or to actually use the project.

Although, that path leads you (hopefully) to having two finished versions of one working code base. At that point, you'd probably want to merge the second version back into main, under some separate directory.
 
1 members found this post helpful.
Old 02-07-2012, 03:46 PM   #3
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 20; Arch; Kubuntu; Debian
Posts: 711

Original Poster
Rep: Reputation: 31
Oh, ok. That makes sense. Especially the part about having access to the previously working version if you needed to use it while you were working on the other version. Is the reason for merging into another directory in order to preserve the old version?
 
Old 02-07-2012, 04:01 PM   #4
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 208Reputation: 208Reputation: 208
Actually, I take that back -- maintaining separate versions of code in different directories is probably not good practice.

But yes, in my situation, I thought that there would be two distinct versions of a central file (driver.c) that could be useful, and wanted them both to be in main (once they were both working.)

Outside of the git discussion, the better way to have achieved this would have been to have one mode "fall back" to the other, within the same code base. That is, if interrupts were determined not to be available, the same code should have provided for polling. So in this case, I would still have made the experimental branch. Later, when I'd tested it, I could merge it back to main, and the code in main would have a super-set of its previous functionality.

But so anyway, my point is that branching is useful to separate development code from code that is relatively stable, so that you -- and others -- can continue to use the main branch in "production" while other relevant development histories are being contributed.
 
Old 02-08-2012, 01:11 AM   #5
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,906

Rep: Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545
You can definitely use this process on a one-person project:

http://scottchacon.com/2011/08/31/github-flow.html
 
  


Reply

Tags
git


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make anyone can git clone my project huguohu Linux - Server 0 08-01-2011 09:07 AM
how to make anyone can git clone my project huguohu Linux - Software 0 07-30-2011 10:39 AM
LXer: Weekend Project: Using git to Manage Config Files LXer Syndicated Linux News 0 04-17-2011 03:50 PM
Accidantally deleted project with git rm, HOW TO GET IT BACK! MTK358 Programming 9 12-05-2009 02:40 PM
LXer: GNOME desktop project migrates to Git LXer Syndicated Linux News 0 03-22-2009 07:50 PM


All times are GMT -5. The time now is 04:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration