In general, we do not modify code on the Master branch to ensure consistency between the master branch and the remote Master branch.
Switch branch
Switch from branch A to branch B. Execute Git Checkout B at branch A
- If uncommitted files exist in branch A, you cannot switch to branch B directly. You need to perform the Git-Stash hide changes on branch A first, then perform Git Checkout B, and then use the Git-Stash pop to restore the changes when you switch back to branch A in the future.
Push branch to remote and want to merge to master
Push branch A remote and create a merge application to master branch
Since the remote master branch has been modified, branch A needs to merge the changes made by the master branch before pushing it
Git rebase master: Git rebase master: git rebase master: git rebase masterCopy the code
Merge multiple Commits
Merge multiple Commits
Git rebase -i HEAD~3 Will be in addition to the first pick, the other is to s or squash pick 3 ca6ec3 'comment * * * * * * * * * *' s 1 b40566 'comment * * * * * * * * *' s 53 f244a 'comment * * * * * * * * * *' step 3: If there are conflicts, modify the conflicting files. Git add. Git rebase --continue Git push -fCopy the code