【问题标题】:Can not see the commits for pushing in Pycharm在 Pycharm 中看不到推送的提交
【发布时间】:2022-01-07 19:32:48
【问题描述】:

我做了一些提交,但我看不到它们的推送。

我读过这可能与没有遥控器有关?但这里是命令行的结果:

$ git remote
origin 

更新:

git status 命令结果:

git status
HEAD detached from 5235085
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    .idea/
    Connect4Py/__pycache__/

nothing added to commit but untracked files present (use "git add" to track)

git branch -avv 命令结果:

git branch -avv
* (HEAD detached from 5235085) 908eb97 Fix: - New camera OpenCV configurations      - Improved the Yellow and Red Ball detections.      - Improved the Matrix placement of the balls.
  main                         6dc0b73 [origin/main] Fix: bug fixes
  temp                         1e084c0 Fix: - New camera OpenCV configurations      - Improved the Yellow and Red Ball detections.      - Improved the Matrix placement of the balls.
  remotes/origin/HEAD          -> origin/main
  remotes/origin/main          6dc0b73 Fix: bug fixes

注意:fix: bug fixes 提交不是我做出的,那是另一个用户,他的 commit-push 命令是成功的。

【问题讨论】:

    标签: git pycharm


    【解决方案1】:

    仍在命令行中,检查输出是否为git status

    如果您处于分离 HEAD 模式(不在分支中),请检查您的本地和远程分支 (git branch -avv),然后查看您应该使用哪一个。
    然后你可以switch to the right branch, and merge your detached HEAD

    git switch -c tmp
    git switch main
    git merge tmp
    git branch -d tmp
    

    对于较旧的 Git:

    git checkout -b tmp
    git checkout main
    git merge tmp
    git branch -d tmp
    

    从那里,您将能够推送,包括从 PyCharm。

    【讨论】:

    • 对不起,我对这些东西真的很陌生。我更新了我的问题,你能解释一下从那里一步一步做什么吗?
    • @noobie 没问题。我已经相应地编辑了答案。
    • 我得到 git:'switch' 不是 git 命令。错误。我检查并更新了git:git已经是最新版本(1:2.17.1-1ubuntu0.9)但仍然无法使用switch命令。我看过这个解决方案:stackoverflow.com/questions/47630950/… 但我不敢使用这些命令,因为项目真的很大而且还有其他贡献者
    • @noobie 2.17?我还没有出生。您可以尝试升级到 2.34.1 吗? stackoverflow.com/a/41357503/6309
    • @noobie 如果无法升级,我已经使用旧 Git 的旧命令编辑了答案。
    猜你喜欢
    • 2020-09-19
    • 2021-06-23
    • 2011-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-03
    • 2012-03-14
    相关资源
    最近更新 更多