You can't create a new branch with this command
git checkout --track origin/branch
if you have changes that are not staged.
Here is example:
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: src/App.js
no changes added to commit (use "git add" and/or "git commit -a")
// TRY TO CREATE:
$ git checkout --track origin/new-branch
fatal: 'origin/new-branch' is not a commit and a branch 'new-branch' cannot be created from it
However you can easily create a new branch with un-staged changes with git checkout -b
command:
$ git checkout -b new-branch
Switched to a new branch 'new-branch'
M src/App.js