cannot push to github: everything up-to-date

后端 未结 5 2028
被撕碎了的回忆
被撕碎了的回忆 2020-12-28 16:16

On github, I forked an old version of another project. I made some changes and am trying to push them onto my fork on github. I commited the changes locally, then tried git

相关标签:
5条回答
  • 2020-12-28 16:37

    Not sure why people are down voting the guy with the correct answer. For me adding my email and name did resolve the issue. Although the commands are not correct.

    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"
    
    0 讨论(0)
  • 2020-12-28 16:43
    git commit 
    

    Will show you what files are on your local machine, uncomment what you want to upload and

    git push origin master
    

    Because git add * did not work for me (even if it didn't returned errors).

    0 讨论(0)
  • 2020-12-28 16:50

    After you change files, you need to

    git add
    

    them prior to

    git commit
    

    .

    0 讨论(0)
  • 2020-12-28 16:52

    git branch -v indicates that my commit was on (no branch). As for the add, I initially commited the changes through Eclipse (with the git plugin)...when I do git add from the command line, it doesn't seem to do anything

    That means you are in a DETACHED HEAD mode.
    You can add and commit, but from the upstream repo point of view (ie from the GitHub repo), no new commits are ready to be pushed.
    You have various ways to include your local (detached HEAD) commit back into a branch, which you will be able to push then.
    See:

    • "Not currently on any branch + git commit + checkout when not in any branch. Did I loose my changes?"
    • "detached HEAD explained".
    • "Git: How can I reconcile detached HEAD with master/origin?"
    • "Git Lesson: Be mindful of a detached head"
    • "Git Tip of the Week: Detached Heads"

    The OP mentions this article in order to fix the situation:
    "git: what to do if you commit to no branch"

    all we need to do is checkout the branch we should have been on and merge in that commit SHA:

    Note that instead of merging the SHA1 that you would have somehow copied, you can memorize it with a script, using head=$(git rev-parse HEAD):
    See "git: reliably switching to a detached HEAD and then restore HEAD later, all from a script".
    Then you can merge that detached HEAD back to the right branch.

    0 讨论(0)
  • 2020-12-28 16:55

    In recent git version have to configer user details git config -g user.name "name"

    git config -g user.email "ab@mil.com"
    

    This resolved my problem

    0 讨论(0)
提交回复
热议问题