Hello, I'm Ganesh. I'm working on FreeDevTools online, currently building a single platform for all development tools, cheat codes, and TL; DRs — a free, open-source hub where developers can quickly find and use tools without the hassle of searching the internet.
In this blog, we will learn about git rebase.
Git Rebase
When you create a new branch and start committing changes, you create a divergent history (DAG) for that branch.
# 1. Create and switch to a new branch
git checkout -b new-feature
# 2. Make some commits
git add .
git commit -m "D"
Meanwhile, other contributors may have pushed new commits to the main branch, meaning your branch is now behind.
# Switch to main and pull latest changes
git checkout main
git pull origin main
When you perform a rebase, Git takes the commits from your new branch and "replays" them on top of the latest commit of the main branch.
Once the rebase is done, the original commits from your new branch are orphaned (no longer used), and your branch now has a clean, linear history extending from the latest main.
Note: If you run into conflicts during the rebase, fix the files, add them, and run:
git rebase --continue
Conclusion
We understood how rebase works.
Here are commands to work with it.
| Command | Description |
|---|---|
git checkout -b <branch> |
Creates and switches to a new branch. |
git rebase main |
Moves your current branch's commits to the tip of main. |
git rebase --continue |
Continues the rebase process after resolving conflicts. |
git rebase --abort |
Stops the rebase and returns the branch to its original state. |
I’ve been building for FreeDevTools.
A collection of UI/UX-focused tools crafted to simplify workflows, save time, and reduce friction when searching for tools and materials.
Any feedback or contributions are welcome!
It’s online, open-source, and ready for anyone to use.
👉 Check it out: FreeDevTools
⭐ Star it on GitHub: freedevtools



Top comments (0)