-
-
Save voodoohop/5e5abcc252c34b806ab2654b6985bf36 to your computer and use it in GitHub Desktop.
A git rebase workflow explained
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To add a change to our repository | |
git checkout -b "feature/feature-name" # Creates a branch called "feature/feature-name", then checks it out, locally. | |
git push --set-upstream origin feature/feature-name # Publish the branch on GitHub | |
# Make changes to your files | |
git add FILENAME(S) # Adds your files to "Tracked". | |
git status # See your "Tracked and Untracked files (green and red respectively" | |
# If you're happy with these make a commit | |
git commit -m "Makes a commit message of less that 50 characters long" | |
git push # Send your commits to the remote | |
# When you're ready to move your changes to master, make a Pull Request on Github. Add your reviewers and wait for your change requests | |
# Make your change requests and push your changes to Github | |
# Once you have approval you can go ahead with the merge process | |
git checkout feature/feature-name # Switch to your feature branch | |
git fetch --all # Update all of your branches with any changes people have made | |
git pull -r # Updates your current branch with any changes someone else may have made to that branch | |
git rebase master # Adds any changes from master behind any of your changes. You may have to resolve conflicts here. | |
git push --force-with-lease # Safely adds the rebased version of your branch to Github | |
git checkout master # Switch to master branch | |
git pull # Make sure your branch is up to date | |
git merge --no-ff feature/feature-name # Merge your changes to your local copy of master | |
git push # Updates master with your new feature | |
# Finally delete your unused branch from GitHub | |
# Merge complete! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment