私信  •  关注

Peter Mortensen alexshr

Peter Mortensen alexshr 最近创建的主题
Peter Mortensen alexshr 最近回复了
6 年前
回复了 Peter Mortensen alexshr 创建的主题 » Github:这个分支是X提交的[duplicate]

Android Studio现在已经学会了使用GitHub fork存储库(您甚至不必通过控制台命令添加“上游”远程存储库)。

打开菜单 风投 吉特

注意最后两个弹出菜单项:

  • 让我的GitHub叉子后退

试试看。我使用第一个来同步本地存储库。不管怎样,在点击“Rebase my GitHub fork”之后,来自父远程存储库(“upstream”)的分支将可以在Android Studio中访问,并且您将能够轻松地使用它们。

(我使用Android Studio 3.0和“Git集成”和“GitHub”插件。)

Enter image description here

8 年前
回复了 Peter Mortensen alexshr 创建的主题 » Github:这个分支是X提交的[duplicate]

遵循以下步骤。我试过了,它帮了我。

结帐到您的分行

语法: 吉特分行你的发展分行
切换到主分支

语法: https://github.com/tastejs/awesome-app-ideas 主人
吉特拉力 https://github.com/ORIGINAL_OWNER/ORIGINAL_REPO.git 分行名称

6 年前
回复了 Peter Mortensen alexshr 创建的主题 » Github:这个分支是X提交的[duplicate]

实际上,可以通过浏览器中上游的任何提交在fork中创建分支:

Enter image description here

它是如何工作的(只是猜测,我不知道GitHub究竟是如何工作的):forks共享对象存储和使用 namespaces 以分离用户的引用。因此,即使叉叉不存在,也可以通过叉来访问所有提交。

8 年前
回复了 Peter Mortensen alexshr 创建的主题 » Github:这个分支是X提交的[duplicate]

https://github.com/isaacs/github/issues/121

注意:由于功能请求是非官方的,所以最好联系 support@github.com 添加对要实现的此类功能的支持。上面的非官方特性请求可以用作对正在实现的这个特性感兴趣的数量的证据。

8 年前
回复了 Peter Mortensen alexshr 创建的主题 » Github:这个分支是X提交的[duplicate]

很多答案最后都会转移你的叉子 一次承诺 here 哪个会 .

  1. 将目录更改为本地存储库。

    • 如果你不是,切换到主分支 git checkout master
  2. 将父存储库添加为远程存储库, git remote add upstream <repo-location>

  3. git fetch upstream
  4. 发行 git rebase upstream/master

    • 在此阶段,您将通过键入 git status
  5. 发行 git push origin master

step 3 .

8 年前
回复了 Peter Mortensen alexshr 创建的主题 » Github:这个分支是X提交的[duplicate]

这是GitHub的官方文件 Syncing a fork :

设置

在同步之前,需要添加指向上游存储库的远程。你可能是在最初用叉子叉的时候做的。

$ git remote -v
# List the current remotes
origin  https://github.com/user/repo.git (fetch)
origin  https://github.com/user/repo.git (push)

$ git remote add upstream https://github.com/otheruser/repo.git
# Set a new remote

$ git remote -v
# Verify new remote
origin    https://github.com/user/repo.git (fetch)
origin    https://github.com/user/repo.git (push)
upstream  https://github.com/otheruser/repo.git (fetch)
upstream  https://github.com/otheruser/repo.git (push)

同步

将存储库与上游同步需要两个步骤:首先必须从远程获取,然后必须将所需的分支合并到本地分支。

提取

$ git fetch upstream
# Grab the upstream remote's branches
remote: Counting objects: 75, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 62 (delta 27), reused 44 (delta 9)
Unpacking objects: 100% (62/62), done.
From https://github.com/otheruser/repo
 * [new branch]      master     -> upstream/master

我们现在将上游的主分支存储在本地分支upstream/master中

$ git branch -va
# List all local and remote-tracking branches
* master                  a422352 My local commit
  remotes/origin/HEAD     -> origin/master
  remotes/origin/master   a422352 My local commit
  remotes/upstream/master 5fdff0f Some upstream commit

现在我们已经获取了上游存储库,我们希望将其更改合并到本地分支中。这将使该分支与上游同步,而不会丢失本地更改。

$ git checkout master
# Check out our local master branch
Switched to branch 'master'

$ git merge upstream/master
# Merge upstream's master into our own
Updating a422352..5fdff0f
Fast-forward
 README                    |    9 -------
 README.md                 |    7 ++++++
 2 files changed, 7 insertions(+), 9 deletions(-)
 delete mode 100644 README
 create mode 100644 README.md

$ git merge upstream/master
Updating 34e91da..16c56ad
Fast-forward
 README.md                 |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

提示:如果要更新GitHub上的存储库,请按照说明进行操作 here