2016-11-16 20 views
0

gitコマンドに関する質問があります。 git stashから更新をキャンセルしようとしました。 しかし、私はそれをすることができませんでした。更新をキャンセルできません

次のコマンドを使用します。

~/xxxxx-repo on  master! ⌚ 18:27:45 
$ git checkout . 
                                        ~/xxxxx-repo on  master! ⌚ 18:28:02 
$ git status                                              2.3.1 
On branch master 
Your branch is behind 'origin/master' by 3 commits, and can be fast-forwarded. 
    (use "git pull" to update your local branch) 
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: .gitignore 
    modified: app/Api/Middleware/ViewSwitchMiddleware.php 
    modified: app/Common/Data/Api/Lib/ParamWithPaginator.php 
    modified: app/Common/Data/DB/Sample.php 
    modified: app/Common/Data/DB/User.php 
    modified: app/Framework/Data/CurlBasicManager.php 
    modified: app/Framework/Lib/ArrayObject.php 
    modified: app/Tool/Middleware/ViewSwitchMiddleware.php 
    modified: config/data.php 
    modified: nbproject/project.properties 
    modified: nbproject/project.xml 
    modified: public/vendor/cleditor/jquery.cleditor.css 
    modified: public/vendor/cleditor/jquery.cleditor.js 
    modified: public/vendor/cleditor/jquery.cleditor.min.js 

no changes added to commit (use "git add" and/or "git commit -a") 

~/xxxxx-repo on  master! ⌚ 18:28:05 
$ git pull origin master                                           2.3.1 
remote: Counting objects: 8, done. 
remote: 
Unpacking objects: 100% (8/8), done. 
From ssh://xxxxxxx.xxxx.com/v1/repos/xxxxxx-repo 
* branch   master  -> FETCH_HEAD 
    3803c7a..850eb4c master  -> origin/master 
Updating ee9814f..850eb4c 
error: Your local changes to the following files would be overwritten by merge: 
    app/Framework/Data/CurlBasicManager.php 
    config/data.php 
Please commit your changes or stash them before you merge. 
Aborting 

なぜ私の更新をキャンセルしませんでしたか?

私は今日このエラーを苦労しています。

このリポジトリを削除しようとしました。

私は同じリポジトリをクローンします。

私は次のコマンドを試しました。

しかし、まだファイルを更新していなくても同じエラーが再現されました。

私は次のようにしました。 しかし私はまだ私の問題を解決することができませんでした。

 ~/XXXXXXx-repo on  master! ⌚ 20:35:30 
    $ git add app/Framework/Data/CurlBasicManager.php                                     2.3.1 
    warning: CRLF will be replaced by LF in app/Framework/Data/CurlBasicManager.php. 
    The file will have its original line endings in your working directory. 

    ~/XXXXXX-repo on  master! ⌚ 10:24:08 
    $ git add config/data.php                                           2.3.1 
    warning: CRLF will be replaced by LF in config/data.php. 
    The file will have its original line endings in your working directory. 

    ~/XXXXX-repo on  master! ⌚ 10:24:29 
    $ git stash                                              2.3.1 
    warning: CRLF will be replaced by LF in .gitignore. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Api/Middleware/ViewSwitchMiddleware.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Common/Data/Api/Lib/ParamWithPaginator.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Common/Data/DB/Sample.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Common/Data/DB/User.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Framework/Lib/ArrayObject.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Tool/Middleware/ViewSwitchMiddleware.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in nbproject/project.properties. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in nbproject/project.xml. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in public/vendor/cleditor/jquery.cleditor.css. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in public/vendor/cleditor/jquery.cleditor.js. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in public/vendor/cleditor/jquery.cleditor.min.js. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in .gitignore. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Api/Middleware/ViewSwitchMiddleware.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Common/Data/Api/Lib/ParamWithPaginator.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Common/Data/DB/Sample.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Common/Data/DB/User.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Framework/Lib/ArrayObject.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in app/Tool/Middleware/ViewSwitchMiddleware.php. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in nbproject/project.properties. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in nbproject/project.xml. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in public/vendor/cleditor/jquery.cleditor.css. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in public/vendor/cleditor/jquery.cleditor.js. 
    The file will have its original line endings in your working directory. 
    warning: CRLF will be replaced by LF in public/vendor/cleditor/jquery.cleditor.min.js. 
    The file will have its original line endings in your working directory. 
    Saved working directory and index state WIP on master: ee9814f refs #4 XXXXXXXXXXXXXXXXXX 
    HEAD is now at ee9814f refs #4 XXXXXXXXXXXXXXXXXXXX 

    ~/XXXXX-repo on  master! ⌚ 10:24:36 
    $ git pull                                               2.3.1 
    remote: Counting objects: 47, done. 
    remote: 
    Unpacking objects: 100% (47/47), done. 
    From ssh://XXXXXXXXXXXXXXXX/v1/repos/CandY-repo 
    850eb4c..2410322 master  -> origin/master 
    Updating ee9814f..2410322 
    error: Your local changes to the following files would be overwritten by merge: 
    app/Framework/Data/CurlBasicManager.php 
    config/data.php 
    Please commit your changes or stash them before you merge. 
    Aborting 

私はまだ苦労してる...

+0

どのオペレーティングシステムを使用していますか? – Ivan

+0

上記の後、あなたは 'git stash'を行い、' git pull'をやり直して同じ結果を得ましたか? 'git status'は隠しの後にあなたに何を表示しますか? – bcmcfc

+0

@lvan \t 私はMac OS Xを使用します –

答えて

1

なぜ私の更新をキャンセルしませんでしたか?

git checkout .は、インデックスからファイルを取得して作業ディレクトリに復元します。 あなたの変更は既にステージングされています(つまり、インデックス内にあるため)、それらを破棄するにはgit checkout HEAD .が必要でした。

問題については、core.autocrlfをtrueに設定しましたか? これは、Windows上でUnixで作成されたリポジトリで作業しているときに使用される設定です。それはあなたのためではありません。 この設定は、おそらく問題の原因となる、追加時にCRLFをLFに変換します。 コアを設定できます。でfalseにautocrlf:あなたは、グローバル設定をしたい場合

git config --local core.autocrlf false 

--globalの代わり--localでそれを実行します。

+0

ありがとう!私はそれを試してみます。 –

0

は今、質問が更新されている問題のカップルがあるように思われます。

異なるOSは、異なる行末を使用します。

Gitは、毎回それらを変更しようとしないように、それらを単独で残すように設定することができます。この質問と回答の詳細:How to change line-ending settings

その他の問題は、問題のファイルが追跡されていない可能性があり、そのために隠されていない可能性があります。

git add app/Framework/Data/CurlBasicManager.php 
git add config/data.php 

その後

git stash 

次に、あなたはgit pullできるようになります。

git statusの出力は、何が起こっているかを常に説明します。

+0

残念ながら、同じエラーが発生しました。私は私の質問を更新します。 –

+0

私の同僚はウィンドウを使用しますが、私はmac.probablyを使用します。 –

+0

元の質問にすべてのエラー出力を含める必要があります。それは本当に存在しませんでしたか? – bcmcfc

関連する問題