How should I use the git branches?
New to git. A bit confused about how some of it works, conceptually.
So it sounds like, in terms of local work, its a good idea to have a branch that contains only what goes into production and another for testing 开发者_StackOverflow社区out ideas, etc. which I can then merge. Is it as simple as creating those branches and then when I don't want any recent changes to my project to be committed to the master branch, I just switch to the "testing" branch and commit/push from there? I'm just confused about the interaction between local project activity and git.
Say, for example, I add some code to my android project and save, those changes will have no effect on master repo unless I commit? And that's the case even though, in terms of the actual local project, those changes were saved.
Am I thinking about this right? If not, set me straight?
Say, for example, I add some code to my android project and save, those changes will have no effect on master repo unless I commit? And that's the case even though, in terms of the actual local project, those changes were saved.
Actually they won't change anything in the master repo until you push. It will change your local repo when you commit.
It's really up to you how you want to organize your branches (really depends on how many things you work at the same time), but you can always have those branches, commit to them and when you have something consistent, you can always create a new branch of things to merge, use cherry-pick and/or rebase -i to make it a clean serie of commits and merge/push that branch.
Creator of git, Linux Torvalds, gave a speech 3 years ago at Google on Git: http://www.youtube.com/watch?v=4XpnKHJAok8
Git Wiki page: https://git.wiki.kernel.org/index.php/Main_Page
精彩评论