Git branch vs commit
git branch test checkout test
i deleted file README in the project folder
then i run
git checkout master
and there is no README file anymore.
I thought when you create new branch its like creating new commit?
One Solution collect form web for “Git branch vs commit”
Creating a branch is not like creating a new commit. Creating a branch is creating a easy to read reference to a commit hash.
So by being on the
master branch and then going:
git branch test git checkout test rm README git checkout master
You will still have unstaged changes on the
master branch, because you didn’t actually do anything to
If you do
git status you should have README missing.
You can get it back by doing
git checkout README