Git pull to update master

Working mostly on the branches I create and dev branch. a) Do I need to keep master up-to-date? It says I am behind by 418 commits. What will happen when I do a git pull when I am behind so many commits?

Depends on what you want to do, @kimkhan. I believe that master is generally intended to be the latest “stable”, complete version of your project and, as such, I think it should be updated when you have completed working on a branch. Branches are generally intended to be “temporary” things where you can do some work without messing up your base project.

Say you create a branch to add a feature. When you’re done and feature works, then merge it into master and push to master. At that point, you can keep or delete the branch you were working on.

I tend to keep branches around for a bit and then delete them. Also, I don’t let myself get that far behind on master… if you have lots of separate code branches, each with different stuff, than I would find that very confusing.

Also, if you git pull master, then master will be updated with your (old) stuff, but all your branches will be kept up to date.

My 2 cents.

Nice explanation. Thank for your two cents @JESii.