'git branch' не показывает названия веток - PullRequest
0 голосов
/ 12 июня 2018

Я использую Git на Ubuntu.

git branch не показывает названия филиалов.Я пытался клонировать разные репозитории, но опять же git branch не показывает названия веток.Я также создал новый репозиторий, и он такой же.

Пример:

>git clone https://github.com/uber/pyro.git
Cloning into 'pyro'...
remote: Counting objects: 13342, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 13342 (delta 8), reused 0 (delta 0), pack-reused 13319
Receiving objects: 100% (13342/13342), 55.85 MiB | 5.34 MiB/s, done.
Resolving deltas: 100% (9814/9814), done.
>ls
pyro
>cd pyro
>git branch -a
>git branch -r
>git branch
>git status
On branch dev
Your branch is up to date with 'origin/dev'.

Добавление другой ветки:

>git checkout -b branch1
Switched to a new branch 'branch1'
>git branch
>

Я также зафиксировал один раз.и это то же самое.

>GIT_TRACE=1 git branch
15:39:13.295464 git.c:344               trace: built-in: git branch
15:39:13.296121 run-command.c:640       trace: run_command: unset 
GIT_PAGER_IN_USE; LESS=FRX LV=-c pager
>git --version
git version 2.17.1
>
>env -i git branch
WARNING: terminal is not fully functional
* devress RETURN)
>

Я протестировал те же команды на другом ноутбуке, и он работает.(Я также удалил git и переустановил его. Это не помогает)

Есть идеи, как это исправить?

Ответы [ 3 ]

0 голосов
/ 16 июня 2018

Это не полный ответ, но, основываясь на длительном обсуждении в чате, похоже, что он взаимодействует с пейджером.

Среда пользователя включает в себя следующие переменные (среди прочих):

LESSOPEN='| /usr/bin/lesspipe %s'
LESSCLOSE='/usr/bin/lesspipe %s %s'

Это настройки по умолчанию в Ubuntu, поэтому не должен вызывать проблему.

git branch не выводит.

GIT_PAGER=/bin/cat git branch выдает правильный вывод.

Я еще не выяснил, почему пейджер должен вызывать эту проблему, но, так как изменение GIT_PAGER на /bin/cat - это обходной путь, это должно быть проблемой.

0 голосов
/ 19 июня 2018

Я отключил git-пейджер для git branch с помощью git config --global pager.branch false.Теперь я могу получить вывод git branch.Но мы не поняли, в чем проблема пейджера.Для других команд, таких как git diff, такая же проблема существует.

0 голосов
/ 12 июня 2018

Показать локальные ветви:

git branch

Поскольку вы клонируете из удаленных / исходных веток, оно не будет отображаться с использованием git branch.Вам нужно хотя бы посетить эту ветку, используя git checkout.Ниже приведены команды git.Я создал новую ветку hotfix-test, а затем использовал git branch

~/pyro (dev)

    $ git checkout -b hotfix-test
    Switched to a new branch 'hotfix-test'

~/pyro (hotfix-test)

    $ git branch
      dev
    * hotfix-test

Оформить текущую ветку в другую существующую ветвь.

$ git checkout lax
Switched to a new branch 'lax'
Branch lax set up to track remote branch lax from origin.

~/pyro (lax)
 $ git branch
          dev
          hotfix-test
        * lax

Шаги клонирования и ветви происхождения

 ~/desktop (master)
$ git clone https://github.com/uber/pyro.git
Cloning into 'pyro'...
remote: Counting objects: 13342, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 13342 (delta 8), reused 0 (delta 0), pack-reused 13319
Receiving objects: 100% (13342/13342), 55.85 MiB | 2.69 MiB/s, done.
Resolving deltas: 100% (9814/9814), done.

~/desktop (master)
$ cd pyro

desktop/pyro (dev)
$ git branch -a
* dev
  remotes/origin/0.1.2-release
  remotes/origin/0.2.0-release
  remotes/origin/0.2.1-release
  remotes/origin/HEAD -> origin/dev
  remotes/origin/ast-char-rnn
  remotes/origin/bnn-mnist
  remotes/origin/causal-tutorial
  remotes/origin/continuation-poutine
  remotes/origin/continuation-with-indep
  remotes/origin/cubo
  remotes/origin/dev
  remotes/origin/dice-elbo
  remotes/origin/gh-pages
  remotes/origin/glom-autoname
  remotes/origin/hmc
  remotes/origin/jit-integration-tests
  remotes/origin/lax
  remotes/origin/lax2
  remotes/origin/maps-iei
  remotes/origin/master
  remotes/origin/mvn-sym
  remotes/origin/mvncv
  remotes/origin/nightmare-poutine
  remotes/origin/nips-2017
  remotes/origin/only-continuation-poutine
  remotes/origin/only-parallel-enumeration
  remotes/origin/paul-mh-12-1
  remotes/origin/pcg
  remotes/origin/pragmatics-example
  remotes/origin/ps-semaphore
  remotes/origin/pyro_GP
  remotes/origin/recursion-scope
  remotes/origin/regtest-1
  remotes/origin/rejector-research
  remotes/origin/revert-611-verlet-pr
  remotes/origin/rsa-ccg-example
  remotes/origin/sampling-hash
  remotes/origin/snorkel-example
  remotes/origin/trace-posterior-sample-fix
  remotes/origin/tst
  remotes/origin/vec-rand-module

 ~/desktop/pyro (dev)
$ git branch -r
  origin/0.1.2-release
  origin/0.2.0-release
  origin/0.2.1-release
  origin/HEAD -> origin/dev
  origin/ast-char-rnn
  origin/bnn-mnist
  origin/causal-tutorial
  origin/continuation-poutine
  origin/continuation-with-indep
  origin/cubo
  origin/dev
  origin/dice-elbo
  origin/gh-pages
  origin/glom-autoname
  origin/hmc
  origin/jit-integration-tests
  origin/lax
  origin/lax2
  origin/maps-iei
  origin/master
  origin/mvn-sym
  origin/mvncv
  origin/nightmare-poutine
  origin/nips-2017
  origin/only-continuation-poutine
  origin/only-parallel-enumeration
  origin/paul-mh-12-1
  origin/pcg
  origin/pragmatics-example
  origin/ps-semaphore
  origin/pyro_GP
  origin/recursion-scope
  origin/regtest-1
  origin/rejector-research
  origin/revert-611-verlet-pr
  origin/rsa-ccg-example
  origin/sampling-hash
  origin/snorkel-example
  origin/trace-posterior-sample-fix
  origin/tst
  origin/vec-rand-module

См. Также Почему "git branch" молчит в новых репозиториях?

...