【问题标题】:Problem with pushing a local branch to a remote Git repository and tracking it将本地分支推送到远程 Git 存储库并跟踪它的问题
【发布时间】:2020-07-24 16:52:32
【问题描述】:

我知道 Stack 上有一个类似的问题,这就是我所遵循的,但是当我检查 Git 存储库时,我所做的任何编辑都没有出现。我创建和编辑的分支(“入职”)似乎与主分支完全相同。任何帮助将不胜感激。

编辑我的分支“入职”后,我尝试了以下方法。

git push -u origin 入职

git push -u https://gitlab.com/uw-cocobot/chatbot 入职

git push -u https://gitlab.com/uw-cocobot/chatbot.git 入职

这些都不起作用。

注意:这是我的 .git/config 文件。

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = https://gitlab.com/uw-cocobot/chatbot
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = https://gitlab.com/uw-cocobot/chatbot.git
    merge = refs/heads/master
[branch "Onboarding"]
    remote = origin
    merge = refs/heads/Onboarding

【问题讨论】:

    标签: shell command-line terminal gitlab


    【解决方案1】:

    我怀疑这是由于命令顺序不正确造成的。

    请按以下顺序尝试命令:

    1. git pull
    2. git branch 这应该打印您的实际分支Onboarding ---- 是吗?
    3. 如果是,请更改您的文件并保存。
    4. git add . ----这应该添加一个准备提交的文件
    5. git commit -m "Making one change" ----这会将提交添加到您的本地存储库而不是远程存储库
    6. git push ----这会将您的commit 推送到远程存储库
    7. 登录到 GitLab UI 并查看更改是否反映在 Onboarding 分支中。

    【讨论】:

      猜你喜欢
      • 2011-01-09
      • 2011-02-15
      • 2011-02-15
      • 2016-02-22
      • 1970-01-01
      • 2018-02-12
      相关资源
      最近更新 更多