|
| 1 | +# Video: Rebasing your changes |
| 2 | +git checkout master # switch to master branch |
| 3 | +git pull # get the latest changes from the remote repository |
| 4 | +git log --graph --oneline --all # view the commits in log which we want to rebase |
| 5 | +git checkout refactor # switch to the branch we want to rebase |
| 6 | +git rebase master # rebase the branch on top of master |
| 7 | +git log --graph --oneline --all # view the commits in log after rebasing |
| 8 | +git checkout master # switch to master branch |
| 9 | +git merge refactor # merge the branch into master |
| 10 | +git push --delete origin refactor # delete the remote branch |
| 11 | +git branch -d refactor # delete the local branch |
| 12 | +git push # push the changes to the remote repository |
| 13 | + |
| 14 | +# Video: Another Rebasing example |
| 15 | +# NOTE: working on small changes, hence no need to create a new branch |
| 16 | +code all_checks.py # modify file |
| 17 | +git commit -a -m 'Add a simple network connectivity check' |
| 18 | +git fetch # fetch the changes from the remote repository (to see if our colleagues have made any changes, but doesn't merge them) |
| 19 | +git rebase origin/master # rebase the local changes on top of the remote changes (NOTE: creates conflict here) |
| 20 | +code health_checks.py # fix the conflict |
| 21 | +./health_checks.py # test the code (NOTE:gives error here) |
| 22 | +code health_checks.py # fix the error |
| 23 | +./health_checks.py # test the code |
| 24 | +git add health_checks.py |
| 25 | +git rebase --continue # continue the rebase process |
| 26 | +git log --graph --oneline # view the commits in log after rebasing completely |
| 27 | +git push |
0 commit comments