Why does checkout duplicate(delete or move branch)?

checkout – filename.txt : delete changed
checkout branch-name : move to that branch
I think this could make confuse because of same command but different result.
I want to know why

I gathered a team with 4 people. 2 front-ends and 2 back-ends.
And we are newbie with git. Nevertheless, I am the one who are the best capable of git among us.
So I have to teach them how to use git.
I guess usage of branch is not essential with us because we are not making real service website but for portfolio.
What do you think? Do we have to use a branch?
I want you to reply. Thank you!

1 Like

Think of git checkout as a command to make your working tree or some part of it match a certain state in git history. That could be resetting to the last commit, or switching a branch, or many other things.

Using branches or not has nothing to do with whether you’re working on a “real” service or practicing. It depends on how you’re working on things. With multiple people using branches is definitely a good idea, because that way each of you can do their part at the same time, and you can merge things together later.

I highly recommend you all take a look at the Git Book (it’s online, despite the name):

The link goes to the English version, but there are many translations available, check on the left side of the page. In case you’re short on time to read: The most important chapters are 2 (Git Basics) and 3 (Git Branching). :wink:

2 Likes

Thank you!
I like your reply and it is very helpful.

1 Like