简体   繁体   English

Git:重新掌握。 怎么办?

[英]Git: Rebased to Master. Now what?

Here's my workflow from today: 这是我今天的工作流程:

🍰  app: $ git branch
  global-nav-text
* master
  thrills-popUp
🍰  app: $ git checkout thrills-popUp
Switched to branch 'thrills-popUp'
Your branch is up-to-date with 'origin/thrills-popUp'.
🍰  app: $ git status
On branch thrills-popUp
Your branch is up-to-date with 'origin/thrills-popUp'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    ngrok
    simple-cors-http-server.py

nothing added to commit but untracked files present (use "git add" to track)
🍰  app: $ git branch
  global-nav-text
  master
* thrills-popUp
🍰  app: $ git checkout global-nav-text
Switched to branch 'global-nav-text'
Your branch is up-to-date with 'origin/global-nav-text'.
🍰  app: $ git rebase master
Current branch global-nav-text is up to date.
🍰  app: $ git checkout thrills-popUp
Switched to branch 'thrills-popUp'
Your branch is up-to-date with 'origin/thrills-popUp'.
🍰  app: $ git status
On branch thrills-popUp
Your branch is up-to-date with 'origin/thrills-popUp'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    ngrok
    simple-cors-http-server.py

nothing added to commit but untracked files present (use "git add" to track)
🍰  app: $ git branch
  global-nav-text
  master
* thrills-popUp
🍰  app: $ git rebase master
Current branch thrills-popUp is up to date.
🍰  app: $ git commit -am "Coda seems to have junked up my code. Specifically JS. The app wasn't pulling in both parks. Turns out that Coda (or something) changed 'append(newRow)' to 'append(ReturnedwRow).' There was an error from Coda after I rebased the global-nav-text branch to master. I updated the JS and all is working well now."
[thrills-popUp 737b135] Coda seems to have junked up my code. Specifically JS. The app wasn't pulling in both parks. Turns out that Coda (or something) changed 'append(newRow)' to 'append(ReturnedwRow).' There was an error from Coda after I rebased the global-nav-text branch to master. I updated the JS and all is working well now.
 1 file changed, 1 insertion(+), 1 deletion(-)
🍰  app: $ git push --all
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 495 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To https://qfrank@bitbucket.org/uoix/14-03157-front-gate-sales-mat.git
   bb79a23..737b135  thrills-popUp -> thrills-popUp
🍰  app: $ git status
On branch thrills-popUp
Your branch is up-to-date with 'origin/thrills-popUp'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    ngrok
    simple-cors-http-server.py

nothing added to commit but untracked files present (use "git add" to track)
🍰  app: $ git push origin master
Everything up-to-date
🍰  app: $ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
🍰  app: $ git checkout thrills-popUp
Switched to branch 'thrills-popUp'
Your branch is up-to-date with 'origin/thrills-popUp'.
🍰  app: $ git checkout thrills-popUp
Already on 'thrills-popUp'
Your branch is up-to-date with 'origin/thrills-popUp'.

I thought once I rebase that it would "merge" my branches into master . 我以为一旦rebase ,它将“合并”我的分支到master I was wrong. 我错了。

I assumed (after rebase ) that when I ran git branch I would only see the master and none of the branches. 我假设(在rebase之后),当我运行git branch我只会看到master而没有分支。

Here's what I had: 这是我所拥有的:

        o------o------o------o------o------o thrills-popUp
       /
-----o------o------o master
  \
   o------o------o global-nav-text

I eventually deleted 'global-text-nav' (but it's still in my remote repo). 我最终删除了“ global-text-nav”(但仍在我的远程仓库中)。

My intention was to merge all branches into the master both locally and remotely. 我的意图是在本地和远程将所有分支合并到主服务器。

How do I do this without messing anything up? 我如何做到这一点而又不弄乱任何东西?

I've been reading about pull , merge , rebase , fetch , etc. But I find it a bit confusing. 我一直在阅读关于pullmergerebasefetch等等的内容,但是我觉得有些混乱。

Here's what I was trying to accomplish: 这是我要完成的工作:

       o------o------o------o------o------o thrills-popUp
      /                                    \
-----o------o-------o-------o-------o-------o------o master
   \               /
    o------o------o global-nav-text

But since I deleted "global-nav-text" locally I'm OK with doing this: 但由于我在本地删除了“ global-nav-text”,因此可以这样做:

       o------o------o------o------o------o thrills-popUp
      /                                    \
-----o-------o-------o-------o------o-------o------o master

I don't want to download the remote repo and mix it with my local one. 我不想下载远程存储库并将其与本地存储库混合使用。 Don't want to cause any screw ups. 不想引起任何麻烦。

I would like to just "cleanly" merge my remaining branch, and have my remote repo look like my local repo. 我只想“干净地”合并剩余的分支,并使我的远程仓库看起来像我的本地仓库。

Also, I see all the commits on my remote repo but none of the new HTML, CSS, and JS files I've added locally. 另外,我在远程存储库上看到所有提交,但没有在本地添加的新HTML,CSS和JS文件。 I see the initial files that were uploaded. 我看到了已上传的初始文件。

I think git merge is what you're looking for. 我认为git merge是您想要的。

This should do what you're trying to accomplish. 这应该可以完成您要完成的任务。

git pull
git fetch origin
git checkout master
git merge thrills-popUp
git merge global-nav-test
git push

It would first fetch the remote repository so that you download the branch you previously deleted, then go on branch master and merge the other two into master. 它将首先获取远程存储库,以便您下载先前删除的分支,然后继续使用分支master,并将其他两个合并到master中。 Then push the changes to the remote repo. 然后将更改推送到远程仓库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用git svn,我只是将功能分支重新设置为master和fast forwarding master。 如何检查我的主人的历史是否是线性的? - Using git svn, I just rebased feature branch onto master and fast forwarded master. How do I check that my master's history is linear? Git分支试图推动掌握。 - Git branches trying to push to master. 将文件移动到主文件夹中。 现在分支有合并冲突 - Moved files into folders in master. Now branches have merge conflicts git:我将master合并为development,现在呢? - git: I merged master into develop, now what? Git提交然后从master中拉入分支。 放松一切? - Git commit and then pull in branch, from master. Loosing everything? Git Hub-该分支在master后面有7个commit。 如何解决呢? - Git hub- This branch is 7 commits behind master. How to resolve this? 我想推到一个不是主人的分支。这就是我做的 - I want to push to a branch which is not master. That is what I did 如果合并或重新设置了主删除分支文件中的主Git`revert` - Git `revert` in master deleting branch files if merged or rebased 有什么方法可以检查哪些分支已针对master重新建立了基础 - Is there any way to check what branches have been rebased against master Git的。 在本地主服务器上重新启动本地分支。 如何忽略单个文件更改? - Git. Rebase local branch atop local master. How do I ignore a single files changes?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM