1)我创建了一个分支
$ mkdir newV4
$ git checkout -b newV4
Switched to a new branch 'newV4'
$ cd newV4/
2)创建一个示例文件并将其推送到repo
$touch new.log
$ git add new.log
$ git status
On branch newV4
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: new.log
$ git commit -m "newchange"
[newV4 d1d982d] newchange
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 newV4/new.log
$ git push --all
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 300 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/chay24/devops.git
98a973e..bfa3aa5 master -> master
* [new branch] newV4 -> newV4
3)与经理合并-----我没有将new.log送到我的主分支
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
$ ls
2.log 3.log 4.log 5.log new newV newV2 newV3 test.log
$ git merge newV4
Updating bfa3aa5..d1d982d
Fast-forward
newV4/new.log | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 newV4/new.log
$ ls
2.log 3.log 4.log 5.log new newV newV2 newV3 newV4 test.log
我想将新文件放入我的主分支,我该怎么做?
答案 0 :(得分:0)
你的过程似乎有点不正确..这就是我的所作所为:
hotfix/my-branch
这会将工作树签出到名为upstream
的新分支,origin/master
设置为$ git push -u origin HEAD
。完成工作后,使用
HEAD
这会将当前$ git checkout master
$ git merge hotfix/my-branch
$ git push -u origin master
推送到您的远程来源,使其全局可用(全局,如有权访问的人)。
如果要合并,请返回当地并执行
hotfix/my-branch
这会在推送后将origin/master
合并到{{1}}。