8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Git】git pullしてYou are not currently on a branch.が出たときに、対処したことメモ

Posted at

git pullしてYou are not currently on a branch.というメッセージが出てしまいました。
対処したことを覚え書きとして残しておきます。

対象ツール・環境

  • Git
  • OS:Windows10
  • コマンドプロンプトを使用

前提条件

前提条件:複数の環境で、masterブランチに対し作業を行っていた

発生事象と解決までの流れ

1.git pullしたところ、以下のようなメッセージが出現

> git pull
remote: Counting objects: XX, done.
Unpacking objects: 100% (XX/XX), done.
From https://XXXXX
   XXXXXX1..XXXXXX2  master     -> origin/master
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

2.メッセージに従ってコマンドを実行したがうまくいかず・・

> git pull origin/master master
fatal: 'origin/master' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

3.ブランチの一覧を確認したところ以下のような結果に

> git branch -vv
* (no branch, rebasing master) XXXXXX1 2. aaaaa
  master                       XXXXXX2 [origin/master: behind 5] 1. bbbbb

→(no branch, rebasing master)に切り替わっている??

4.masterブランチをcheckoutして解決!

> git checkout master

5.ブランチ一覧を再度確認したところ、(no branch, rebasing master)は消えていました

> git branch -vv
* master XXXXXX2 [origin/master: behind 5] 1. bbbbb

原因

おそらくですが、git rebase -iしたこと

8
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?