Git branch vs commit

I have master branch where i commited my last change now i run

git branch test
checkout test

i deleted file README in the project folder

  • Workflow for Using Django South with Multiple Code Branches
  • Git vs SVN: can I have single change in history for several branches?
  • Referencing composer version on branched **and** tagged repository
  • Can I remove individual files from a git branch without deleting them when merging into another branch?
  • Git: Is there a short way to setup a new branch to track a remote branch?
  • Branch descriptions in git, continued
  • 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?

  • Is it possible to build `git` such that the install directory and the deployment prefix is not the same?
  • Git says Automatic merge failed but when i check the file or run the mergetool there are no conflicts they were resolved correctly
  • Adding new roots in git (dropping history)
  • How can I stash my changes and go back to my last check-in in Git?
  • How to mirror a git repository safely?
  • Git rename all javascript to typescript
  • 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 test.

    If you do git status you should have README missing.

    You can get it back by doing git checkout README

    Git Baby is a git and github fan, let's start git clone.