Git 将分支合并到新存储库中
假设我在哪里有这样一个git分支Git 将分支合并到新存储库中,git,github,git-merge,Git,Github,Git Merge,假设我在哪里有这样一个git分支sampath test。我从主repo创建了这个分支。我已经创建了另一个新的存储库(master),比如ionic3-refactured。这个新的master存储库只有一个自述文件。那么,您能告诉我如何将sampath测试代码合并到freshmasterrepoionic3重构?您可以使用它 git push <path to repository> <local branch name>:<remote branch name&
sampath test
。我从主repo
创建了这个分支。我已经创建了另一个新的存储库(master
),比如ionic3-refactured
。这个新的master
存储库只有一个自述文件。那么,您能告诉我如何将sampath测试
代码合并到freshmaster
repoionic3重构
?您可以使用它
git push <path to repository> <local branch name>:<remote branch name>
下面创建一个新的存储库,并将newbranch
与它的历史一起推到其中:
$ mkdir ../newrepo
$ cd ../newrepo/
$ git init
Initialized empty Git repository in /home/chuckx/code/stackoverflow/gitpush/newrepo/.git/
$ cd ../repo1/
$ git push ../newrepo/ branch1:newbranch1
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 596 bytes | 596.00 KiB/s, done.
Total 7 (delta 1), reused 0 (delta 0)
To ../newrepo/
* [new branch] branch1 -> newbranch1
$ cd ../newrepo/
$ git branch
newbranch1
$ ls
$ git checkout newbranch1
Switched to branch 'newbranch1'
$ ls
file1.txt file2.txt file3.txt README
$ git log | grep -v Author
commit bbdbd16488f835ee9bd0903274e45d18b0e621a1
Date: Sun Jun 10 01:02:53 2018 -0700
Add file3.txt
commit 56cd34350e846b92762d16af1c777ff4075fff3e
Date: Sun Jun 10 01:02:23 2018 -0700
Add file1.txt and file2.txt
commit c5d453a847d3b61b75f8a27de3b3cdc163421398
Date: Sun Jun 10 01:01:55 2018 -0700
Add README
也许吧,虽然我真的不明白你想做什么,但这个链接对你的情况应该有帮助。我添加了更多的内容。也请看一下
$ mkdir ../newrepo
$ cd ../newrepo/
$ git init
Initialized empty Git repository in /home/chuckx/code/stackoverflow/gitpush/newrepo/.git/
$ cd ../repo1/
$ git push ../newrepo/ branch1:newbranch1
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 596 bytes | 596.00 KiB/s, done.
Total 7 (delta 1), reused 0 (delta 0)
To ../newrepo/
* [new branch] branch1 -> newbranch1
$ cd ../newrepo/
$ git branch
newbranch1
$ ls
$ git checkout newbranch1
Switched to branch 'newbranch1'
$ ls
file1.txt file2.txt file3.txt README
$ git log | grep -v Author
commit bbdbd16488f835ee9bd0903274e45d18b0e621a1
Date: Sun Jun 10 01:02:53 2018 -0700
Add file3.txt
commit 56cd34350e846b92762d16af1c777ff4075fff3e
Date: Sun Jun 10 01:02:23 2018 -0700
Add file1.txt and file2.txt
commit c5d453a847d3b61b75f8a27de3b3cdc163421398
Date: Sun Jun 10 01:01:55 2018 -0700
Add README