Harness the Power of Interactive Rebasing in Git

lecture 9 interactive rebasing n.w
1 / 11
Embed
Share

Unlock the potential of interactive rebasing in Git to reorder, edit, remove, or amend commits. Learn how to handle conflicts, understand the benefits of rebasing over merging, and explore the process step by step. Dive into a hands-on activity to rebase and organize commits efficiently for a streamlined Git workflow.

  • Git
  • Interactive Rebasing
  • Merge vs Rebase
  • Conflict Resolution
  • Commit Management

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Lecture 9 Interactive Rebasing

  2. Merge vs. Rebase HEAD E' HEAD feature HEAD M master C' HEAD HEAD E feature E feature HEAD HEAD D master D master C C B B A A git rebase master git merge feature

  3. Today More powerful rebasing

  4. HEAD git rebase master E' HEAD feature 1. Move HEAD to merge base of current branch and feature 2. Calculate diff between D and C and apply to D, creating C 3. Calculate diff between C and E and apply to C , creating E 4. Reset feature to E C' HEAD HEAD E feature HEAD D master C B A git rebase master

  5. What about conflicts? Just like merge conflicts, there can be conflicts when applying the diffs Resolve them like normal and use git rebase --continue

  6. Interactive Rebasing Rebasing is super powerful! We can reorder, edit, remove, or amend commits! git rebase -i <commitish> Rebasing onto a commit allows you to change all of the commits in the commit history back to that commit.

  7. Interactive Rebasing

  8. Git Reset Moves branch pointers git reset --soft HEAD~ git reset hard HEAD~2

  9. git commit --amend Add files or edit the commit message of the most recent commit

  10. Force Pushing Rebasing, resetting, and amending commits all move branch pointers to different commits Require force pushing, since the changes are not fast-forwards

  11. Activity/Homework Fork and clone https://github.com/ilanbiala/mergesort. Rebase all of the commits on master into better organized and named commits by using reword, squash, and fixup. You should have between 2-3 commits at the end. Push them to your fork and submit a pull request.

Related


More Related Content