LoginSignup
5
2

More than 3 years have passed since last update.

git addでステージングしたファイルがpushしてもEverything up-to-dateと言われる

Posted at

目的

  • ファイルの差分があるのにpushできない時の筆者の経験談を書く。

原因

  • 単純にコミットメッセージのサマリーの下に空の行が入ってしまっていた。

症状

  • 下記に問題のgitコマンドを記載する。

    MacBook-miriwo:Job_Change admin$ git status
    On branch master
    Your branch is up to date with 'origin/master'.
    
    Changes to be committed:
      (use "git restore --staged <file>..." to unstage)
            new file:   practice/common.md
    
    MacBook-miriwo:Job_Change admin$ git push origin master
    Everything up-to-date
    

問題のコミットメッセージ

  • コミットメッセージサマリの下に空行が入ってしまっている。
  • 下記に問題のコミットメッセージを記載する。

    Add: Advance preparation memo.
    
    # Please enter the commit message for your changes. Lines starting
    # with '#' will be ignored, and an empty message aborts the commit.
    #
    # Date:      Tue Jan 28 23:10:34 2020 +0900
    #
    # On branch master
    # Your branch and 'origin/master' have diverged,
    # and have 1 and 1 different commits each, respectively.
    #   (use "git pull" to merge the remote branch into yours)
    #
    # Changes to be committed:
    #       new file:   company_visit/off_line/08/memo.md
    #       new file:   practice/common.md
    #
    

修正したコミットメッセージ

  • 下記に修正したコミットメッセージを記載する。

    Add: Advance preparation memo.
    # Please enter the commit message for your changes. Lines starting
    # with '#' will be ignored, and an empty message aborts the commit.
    #
    # Date:      Tue Jan 28 23:10:34 2020 +0900
    #
    # On branch master
    # Your branch and 'origin/master' have diverged,
    # and have 1 and 1 different commits each, respectively.
    #   (use "git pull" to merge the remote branch into yours)
    #
    # Changes to be committed:
    #       new file:   company_visit/off_line/08/memo.md
    #       new file:   practice/common.md
    #
    
5
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
5
2