Home > Software design >  Why does this person (see link to article) use checkout to create a feature branch from the developm
Why does this person (see link to article) use checkout to create a feature branch from the developm

Time:12-01

I thought you had to use fetch to get the latest version of a branch from the remote repository. If you do this as the person who wrote the article, don't you create a new feature branch from the "develop" branch that you had stored locally, in other words from a possibly outdated branch?

I have the same question for when he merges his local feature branch to the "develop" branch and pushes it back. He uses checkout here, why not fetch?

link to the article: enter image description here

CodePudding user response:

You are mixing commands meaning. Check git docs.

git-fetch - Download objects and refs from another repository

And article's author creates branch.

git-checkout - Switch branches or restore working tree files

git checkout -b|-B [] Specifying -b causes a new branch to be created as if git-branch1 were called and then checked out.

But also, if you suggest that before creating branch author had to have the latest branch - git-fetch is not enough. It just downloads changes, but you need to integrate those changes into your branch. So then you have to use git-pull which fetches, and integrates changes to the branch.

git-pull - Fetch from and integrate with another repository or a local branch

  • Related