Git branching
Back to fundamentals
This is the second article about git fundamentals. It is largely inspired by the book ProGit, available for free on the git documentation page.
Here we are focusing on branching!
- Merging
Case A: To merge a branch B into your current branch C using rebase in Git, you would follow these steps: Make sure you are in the right branch (branch C):
git checkout C
Rebase:
git rebase B
Resolve any conflicts:
git rebase --continue
After resolving conflicts (if any) and completing the rebase, you can push the changes to the remote repository if necessary:
git push origin C --force
Be cautious when using –force as it will overwrite the history of the remote branch C. Be aware that using rebase can rewrite the commit history, so it’s important to communicate with your team if you’re working on a shared branch.