On Fri, 15 Apr 2016 01:23:20 -0700 (PDT)
Ricardo Morales <r9_...@hotmail.com> wrote:

> I'm using Ubuntu 14.04
> and when I input the commands on the terminal:
>     git branch -a
> or
>    git branch --all
> git only shows the branch I'm on but the others I've created doesn't.
> My git version is the newest (2.8.1) as I upgraded my git when I
> thought my previous was the real problem for this.

Well, sorry for such outright dismissal, but what you say is impossible.
I mean, that couldn't be a bug that would had a chance to slip out
undetected.  So there should be something else going on, which you
don't tell us.

Doing a sheer guess, I can imagine two reasons:

* You're trying to create branches in an empty repository.
  That is, a repository with no commits at all.

  This state of a repository is "interesting" because it contains
  a single so-called "unborn" branch (typically named "master").
  "Unborn" means that the HEAD ref points to the branch "master"
  but the branch itself not yet exist, and the only valid operation
  on it is recording a commit.  Any attempt to create a branch using
  the `git branch <branchname>` command will fail:

    ~% git init foo
    Initialized empty Git repository in /home/kostix/foo/.git/
    ~% cd foo
    foo% git branch -a
    foo% git branch foo
    fatal: Not a valid object name: 'master'.
    foo% git branch bar
    fatal: Not a valid object name: 'master'.
    foo% git branch -a

* You have created your branches in a separate repository, which you
  then pushed somewhere (say, Github, Bitbucket or other Git hosting
  solution; may be your corporate or private one), and then cloned it
  to obtain the repository in which you're now trying to find your

  If so, there might be two reasons I can think of:

  - If actually did not manage to push your original branches,
    and so they weren't fetched when you cloned.

  - The way Git communicates with foreign (remote) repositories
    may be counter-intuitive at first sight -- especially to those
    accustomed with the way centralized VCSes work.

    In short, when you clone a repository you won't get all its branches
    available as normal local branches; not automatically at least.
    We could give your further explanations of this, and pointers to the
    relevant documentation marerial, but before we do that I think
    you should provide more details on your situation.

If you're sure this all does not apply to your case, a sample session
might help -- you could just copy the text from your terminal and paste
it here, like this:

  ~$ git init foo
  Initialized empty Git repository in /home/kostix/foo/.git/
  ~$ cd foo
  foo$ touch aaa
  foo$ git add aaa
  foo$ git commit -m 'Add aaa'
  [master (root-commit) 4806413] Add aaa
   1 file changed, 0 insertions(+), 0 deletions(-)
   create mode 100644 aaa
  foo$ git branch -a
  * master
  foo$ git branch foo
  foo$ git branch -a
  * master
  foo$ git branch bar foo
  foo$ git branch -a
  * master

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to