简体   繁体   中英

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 . I was wrong.

I assumed (after rebase ) that when I ran git branch I would only see the master and none of the branches.

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).

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.

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:

       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. I see the initial files that were uploaded.

I think git merge is what you're looking for.

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. Then push the changes to the remote repo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM