Rebase - iff133/first GitHub Wiki

Branch: 19-run-info-panel

  • Make sure all changes have been saved and pushed git status

Make a copy of the branch

  • git branch 19-run-info-panel-copy

Checkout master

  • git checkout master
  • git pull

Checkout branch: 19-run-info-panel

  • git checkout 19-run-info-panel`

Rebase

  • git rebase -i

  • It will work if all changes are saved and pushed otherwise it will say uncommited/unstaged chnages. If this is the case do:

  • If they aren't git add .

  • `git commit -m"message"

  • Nano editor should appear with the commit history

pick 7c9276a first commit
pick 723df3c second commit
pick 2ae6b4b third commit
pick fc8dd21 fourth commit

# Rebase c602cfa..fc8dd21 onto c602cfa
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
  • Keep the first and last commits exactly like they are
  • substitue the middle commits with an s for squash
pick 7c9276a first commit
s 723df3c second commit
s 2ae6b4b third commit
pick fc8dd21 fourth commit

# Rebase c602cfa..fc8dd21 onto c602cfa
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
  • Ctrl + O to save

  • Enter

  • Ctrl + X to exit the nano editor

  • git push

  • Do git git rebase -i master

    • Solve merge conflicts that might appear using VS code (e.g. src/pages/runs/runs.page.jsx)
      • either accept both changes, incoming change, or current change
      • sometimes it is easier to just quickly change minor things and then accept current change
    • Add resolved conflicts:
      • git status
      • git add src/pages/runs/runs.page.jsx

Continue with rebase

  • git rebase --continue
(alp_virtual) isabel@LAPTOP-7I5Q0I4A ~/alp/alp_web ((no branch, rebasing 19-run-info-panel)) $ git rebase --continue
hint: Waiting for your editor to close the file...

Use "fg" to return to nano.

[1]+  Stopped                 git rebase --continue
  • git status
(alp_virtual) isabel@LAPTOP-7I5Q0I4A ~/alp/alp_web ((no branch, rebasing 19-run-info-panel)) $ git status
interactive rebase in progress; onto 531e5cd
Last command done (1 command done):
   pick 81e4059 WIP - MUST HAVES: DONE
Next commands to do (4 remaining commands):
   s 08e4a8e WIP - MUST HAVES: DONE - update to tests 1
   s 41632be WIP - SHOULD/COULD HAVES: ONGOING
  (use "git rebase --edit-todo" to view and edit)
You are currently rebasing branch '19-run-info-panel' on '531e5cd'.
  (all conflicts fixed: run "git rebase --continue")

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   src/components/run-info/run-info.component.jsx
        new file:   src/components/run-info/run-info.styles.scss
        new file:   src/components/run-info/run-info.test.jsx
        modified:   src/pages/runs/runs.page.jsx
  • Solve merge conflicts that might appear using VS code
    image
    • either accept both changes, incoming change, or current change
    • sometimes it is easier to just quickly change minor things and then accept current change
  • Add resolved conflicts:
    • git status
    • git add .
    • git status
(alp_virtual) isabel@LAPTOP-7I5Q0I4A ~/alp/alp_web ((no branch, rebasing 19-run-info-panel)) $ git status
interactive rebase in progress; onto 531e5cd
Last commands done (3 commands done):
   s 08e4a8e WIP - MUST HAVES: DONE - update to tests 1
   s 41632be WIP - SHOULD/COULD HAVES: ONGOING
  (see more in file .git/rebase-merge/done)
Next commands to do (2 remaining commands):
   s 8a1f6f2 WIP - SHOULD/COULD HAVES: ONGOING 2
   pick bae88b8 4
  (use "git rebase --edit-todo" to view and edit)
You are currently rebasing branch '19-run-info-panel' on '531e5cd'.
  (all conflicts fixed: run "git rebase --continue")

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   package.json
        modified:   src/components/header/header.component.jsx
        modified:   src/components/run-info/run-info.component.jsx
        modified:   src/components/run-info/run-info.styles.scss
        modified:   src/components/run-info/run-info.test.jsx
        modified:   src/pages/runs/runs.page.jsx
        modified:   src/pages/runs/runs.test.jsx
        modified:   yarn.lock

Continue with rebase

  • git rebase --continue
(alp_virtual) isabel@LAPTOP-7I5Q0I4A ~/alp/alp_web ((no branch, rebasing 19-run-info-panel)) $ git rebase --continue
[detached HEAD ce40ead] WIP - MUST HAVES: DONE
 Date: Fri Jan 8 12:42:08 2021 +0000
 8 files changed, 274 insertions(+), 1 deletion(-)
 create mode 100644 src/components/run-info/run-info.component.jsx
 create mode 100644 src/components/run-info/run-info.styles.scss
 create mode 100644 src/components/run-info/run-info.test.jsx
[detached HEAD 7ff4b72] WIP - MUST HAVES: DONE
 Date: Fri Jan 8 12:42:08 2021 +0000
 8 files changed, 271 insertions(+), 1 deletion(-)
 create mode 100644 src/components/run-info/run-info.component.jsx
 create mode 100644 src/components/run-info/run-info.styles.scss
 create mode 100644 src/components/run-info/run-info.test.jsx
Successfully rebased and updated refs/heads/19-run-info-panel.
  • As one can see it says: Successfully rebased and updated refs/heads/19-run-info-panel.
  • Check the status of the barnch: git status
(alp_virtual) isabel@LAPTOP-7I5Q0I4A ~/alp/alp_web (19-run-info-panel) $ git status
On branch 19-run-info-panel
Your branch and 'origin/19-run-info-panel' have diverged,
and have 11 and 5 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

nothing to commit, working tree clean
  • DO NOT USE git pull AS SUGGESTED
  • Force the push with git push --force origin branch_name in this case: git push --force origin 19-run-info-panel
(alp_virtual) isabel@LAPTOP-7I5Q0I4A ~/alp/alp_web (19-run-info-panel) $ git push --force origin 19-run-info-panel
Enumerating objects: 35, done.
Counting objects: 100% (35/35), done.
Delta compression using up to 8 threads
Compressing objects: 100% (22/22), done.
Writing objects: 100% (22/22), 3.95 KiB | 1.97 MiB/s, done.
Total 22 (delta 13), reused 0 (delta 0)
remote:
remote: View merge request for 19-run-info-panel:
remote:   https://gitlab.demarq.com/alp/alp_web/-/merge_requests/4
remote:
To gitlab.demarq.com:alp/alp_web.git
 + bae88b8...faf7cf7 19-run-info-panel -> 19-run-info-panel (forced update)
  • Check the status of the branch git status
(alp_virtual) isabel@LAPTOP-7I5Q0I4A ~/alp/alp_web (19-run-info-panel) $ git status
On branch 19-run-info-panel
Your branch is up to date with 'origin/19-run-info-panel'.
⚠️ **GitHub.com Fallback** ⚠️