![]() Sometimes we need more direct access to the content at master. There’s no reason to have a local master branch to do any of these things. ![]() Need to start a new branch based on master? git branch new-branch origin/master.Need to pull in changes from master? git merge origin/master(usually after a git fetch origin or just do git pull origin master in one step).Need to do a diff against master? git diff origin/master.So if we don’t checkout master locally, how do we these things? Easy - git already allows you to refer to remote branches directly, via remote tracking branches, like origin/master. Take changes that have been made to master and pull them into a feature branch.Start new feature branches off of master.Easy to manage multiple concurrent changes.Įven if we don’t commit directly onto a local master branch, we still often need to refer to the remote master branch to do things like:.Logically groups individual features/bug fixes.Ensures you have an easy way of getting back to a known good state that’s not in the middle of some new feature. ![]() This is a fairly common practice, and I won’t go into full detail on why I think it’s important, but a few good reasons: It’s good to use so-called “topic” or “feature” branches to organize your work into individual features, instead of committing onto what I’ll call “mainline” or “persistent” branches directly. TL DR: Don’t git checkout master use topic branches and detached heads. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |