簡體   English   中英

Git:重新掌握。 怎么辦?

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

這是我今天的工作流程:

🍰  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'.

我以為一旦rebase ,它將“合並”我的分支到master 我錯了。

我假設(在rebase之后),當我運行git branch我只會看到master而沒有分支。

這是我所擁有的:

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

我最終刪除了“ global-text-nav”(但仍在我的遠程倉庫中)。

我的意圖是在本地和遠程將所有分支合並到主服務器。

我如何做到這一點而又不弄亂任何東西?

我一直在閱讀關於pullmergerebasefetch等等的內容,但是我覺得有些混亂。

這是我要完成的工作:

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

但由於我在本地刪除了“ global-nav-text”,因此可以這樣做:

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

我不想下載遠程存儲庫並將其與本地存儲庫混合使用。 不想引起任何麻煩。

我只想“干凈地”合並剩余的分支,並使我的遠程倉庫看起來像我的本地倉庫。

另外,我在遠程存儲庫上看到所有提交,但沒有在本地添加的新HTML,CSS和JS文件。 我看到了已上傳的初始文件。

我認為git merge是您想要的。

這應該可以完成您要完成的任務。

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

它將首先獲取遠程存儲庫,以便您下載先前刪除的分支,然后繼續使用分支master,並將其他兩個合並到master中。 然后將更改推送到遠程倉庫。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM