Skip to content

Instantly share code, notes, and snippets.

@abelcallejo
Last active August 25, 2023 06:53
Show Gist options
  • Save abelcallejo/80bf3351251d0b2d8ba926b73732da5d to your computer and use it in GitHub Desktop.
Save abelcallejo/80bf3351251d0b2d8ba926b73732da5d to your computer and use it in GitHub Desktop.
Pushing changes without conflicts using git rebase

Pushing changes without conflicts using git rebase

1. Get a copy of the latest version

# get the latest version
git checkout master
git pull

# create a new branch and switch to the new branch
git branch my-new-branch-for-awesome-feature
git checkout my-new-branch-for-awesome-feature

2. Make changes

Add, modify, delete files

3. Push the changes

# finalize your new branch
git add *
git commit -m "awesome feature"

# switch to the master branch and update it
git checkout master
git pull

# switch back to your new branch and make its base the same as master
git checkout my-new-branch-for-awesome-feature
git rebase master

# you will be sure that your branch is so updated
git push -u origin my-new-branch-for-awesome-feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment