dadamssg87 Posted June 29, 2011 Share Posted June 29, 2011 I'm new to get and am trying to understand how to effectively use it. I have a few questions. Say you're starting a project from scratch working with a php mvc framework. How often and when should you commit/push? every time you write a function? every time you finish a file(for now)? So commits are labeled with SHA1 hashes, can you take the hash of any commit and use some git voodoo to rebase a specific file to that commit? or does it work more like rebasing your whole branch at a certain point in time(commit)? Quote Link to comment https://forums.phpfreaks.com/topic/240710-anybody-use-git/ Share on other sites More sharing options...
ldb358 Posted July 1, 2011 Share Posted July 1, 2011 For me I commit every time i finish a feature, it passes all the tests and is stable or before i start working on a new feature (these two are usually the same but not always). Also you can revert file to the state that it was in at a commit. another useful thing about git(or any source code control) is that you can use sites like github to make team coding easier. Quote Link to comment https://forums.phpfreaks.com/topic/240710-anybody-use-git/#findComment-1237099 Share on other sites More sharing options...
Adam Posted July 4, 2011 Share Posted July 4, 2011 Group changes into commits that are relevant, part of the same change or at a point where it would make sense. If you write your entire application and then commit, you loose the ability to rewind back to previous states during the development process. If you commit too often, well there's not really a massive down-side to this, but you'll waste plenty of time doing so. It's a good idea to commit fairly regularly though, to make the most of Git's features. "can you take the hash of any commit and use some git voodoo to rebase a specific file to that commit?" You can checkout a single file at a particular commit with: git checkout <commit> <file> Then to go back to the current (HEAD) commit: git checkout HEAD <file> Or you can use reset to reset all files (any changes you've made, staged or not, will be lost) back to the state they're in at HEAD: git reset --hard HEAD You can rebase a whole branch onto another specified commit, merge another branch, cherry-pick commits on to your branch, etc, etc. Git has a lot of powerful features, it just takes time to pick them up. Quote Link to comment https://forums.phpfreaks.com/topic/240710-anybody-use-git/#findComment-1238248 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.