Search code examples
gitbranchgit-commitgit-checkout

Newly committed Git branch is not showing


I'm having an issue with Git, I've switched to a new branch and committed my changes but the new branch is not showing up in the list of branches.

git checkout -b new-branch
git branch
 develop
 *new-branch
git commit -am 'new message'
git push -u origin new-branch
git branch -a
[here the new branch does not show]
git checkout origin/new-branch
error: pathspec 'origin/new-branch' did not match any file(s) known to git.

Is there a step I'm missing?


Solution

  • I think I may have found the answer, I needed to update my remotes list

    git remote update
    

    But this also could have been that I had not added any files to the latest commit. You can check which files are to be committed using

    git status
    

    Then if you want to add everything that is not ignored by .gitignore then you can simply run this from your code root.

    git add .