Best time to commit changes to repo...and branching?

Started by
3 comments, last by deus.ex.nova 10 years, 12 months ago

Since I've been working on a fairly large scale project of my own (2D level editor using XNA/Monogame), I've been using version control much more so than in the past, namely Git. I usually commit both when I feel like I've made major progress (several hours of work) in my code and when the code compiles. This doesn't appear to be the best practice, and I wanted to get some opinions of when it is best to commit to the repository. When do you usually commit?

Also if I'm just working off of a personal repo, what situations call for branching code? So far the only situation I could think of is when I want to try an alternative implementation in my project, and don't want to mess up already functioning systems. I would like to learn more "best practices" when it comes to utilizing version control. I would love to hear any advice. It's a bonus if someone is able to share Git-specific techniques. biggrin.png

Advertisement

With Git you can use Rebase to clean up your commits before pushing to your remote.

http://www.reviewboard.org/docs/codebase/dev/git/clean-commits/

For branching I like to open up an issue ticket at GitHub for the feature I'm working on, create a new branch with the title 'iss01', then merge the branch to master and close the issue when it's done.

With Git you can use Rebase to clean up your commits before pushing to your remote.

http://www.reviewboard.org/docs/codebase/dev/git/clean-commits/

For branching I like to open up an issue ticket at GitHub for the feature I'm working on, create a new branch with the title 'iss01', then merge the branch to master and close the issue when it's done.

What a great resource. It answered so many questions, and some I didn't even expect. Thanks! :)

Another item to consider is looking into GitFlow. It is not a part of git itself and is just a way to work which survives in complex dev environments. See: http://nvie.com/posts/a-successful-git-branching-model/ for more information. It is pretty similar to how we ended up doing things on some insane large projects I've worked on but with the addition of some scripts: https://github.com/nvie/gitflow#readme, it makes things fairly easy compared to our adhock methods in Perforce. An added benefit, if you happen to use Os X, SourceTree (my favorite git front end for OsX) integrates the scripts directly. Point and click git flow is really sweet.

Another item to consider is looking into GitFlow. It is not a part of git itself and is just a way to work which survives in complex dev environments. See: http://nvie.com/posts/a-successful-git-branching-model/ for more information. It is pretty similar to how we ended up doing things on some insane large projects I've worked on but with the addition of some scripts: https://github.com/nvie/gitflow#readme, it makes things fairly easy compared to our adhock methods in Perforce. An added benefit, if you happen to use Os X, SourceTree (my favorite git front end for OsX) integrates the scripts directly. Point and click git flow is really sweet.

Wow, GitFlow makes working with development branches really nice. I've been using GitExtensions because it provides an easy interface for git and I like how it presents the repository graph. I noticed that there's a request to integrate GitFlow into GitExtensions, but it doesn't seem like anyone is trying to implement it. While GitFlow would be really nice to use, I'd rather stick to GitExtensions for now than go back to using the command line for Git. So far I'm really the only one working on this project, so I'm the only one modifying my repo. I will of course adopt the same branching model into my project though. Also I'm certainly open to recommendations for other Git GUI extensions, especially if they have has successfully integrated GitFlow.

*EDIT*
It seems like SourceTree (http://sourcetreeapp.com/) has already integrated GitFlow into it's Mac version, and are working to get their Windows (beta) version up to speed. They're not quite there though, so I guess I'll just stick with GitExtensions for now. I also came across an article by Scott Chacon, where he talks about an alternative version control scheme to GitFlow. His team uses it at GitHub. Here's the link for anyone interested: http://scottchacon.com/2011/08/31/github-flow.html. I *think* the GitFlow model still seems more fitting for my project though...

Also although I'm writing an editor, I'm also building engine code in the same solution. I ended up having separate local repos for each project in the solution. Is it recommended to have one unifying repo instead? It would definitely make keeping track of changes much easier (since there would only be one repo to commit to), but I don't know if there's a big negative that I haven't thought of.

This topic is closed to new replies.

Advertisement