-
Notifications
You must be signed in to change notification settings - Fork 1
Git Helpful Commands
When working in your own branch of code, it is likely the main branch from which you have created your active branch will have changes when you attempt to merge your branch back to main.
This can cause frustration when ready to merge the latest changes in your active branch back in the main branch.
There are two approaches to take in order ot overcome this requirement.
- Merging
- Rebasing
Use Merge when you want to keep a record of all changes made, when a safe method to update is needed without changing past work, or when working with others on a feature and need to track how changes from main were added to your branch.
Use Rebse when a cleaner, linear commit history is required, to avoid merge commits and prefer all commits to appear as thought they are made in sequence, or working on branches that have not been shared with others.
Allows the integration of changes from one branch into another.
Will create a new commit that combines changes from both branches.
- Ensure you are in your active branch
git checkout <your_branch>
- Fetch that latest changes
git fetch origin
- Merge the main branch into your branch
git merge origin/main
-
Any merge conflicts must be resolved.
-
Commit the merge if not handled by git
Rebasing will move your branch commits on top of the latest commits in main.
This approach creates a cleaner project history.
- Switch to your branch
git checkout <your_branch>
- Fetch latest changes
git fetch origin
- Rebase your branch onto main
git rebase origin/master
-
Resolve any conflicts as they are presented
-
Continue rebase after conflict resolution
-
Force Push your branch to update remote history
git push origin <your_branch> --force
© 2026 Clinical Data Interchange Standards Consortium
CDISC is a 501(c)(3) global nonprofit charitable organization with administrative offices in Austin, Texas, with hundreds of employees, volunteers, and member organizations around the world.