Prerequisite: Bus branch is the sum of merge multiple personal branches.
Background: When the bus was released, there was a conflict and the conflict needed to be resolved. The branch merged the branch of the bus and pushed remote.
Hidden danger: If others delete their branch code, re-push the bus branch still has no modification, because the extra code of the bus is submitted by my branch.
Episode: After merging the bus branch, I recommi a package modification commit. After the group of eldest brothers in the question type to find the hidden trouble above.
Solution: own branch reset to merge before the code. Use cherry-pick to commit package changes to pull. Bus branches re-merge. (The reason why the bus remerges instead of resets is because I push-f to cover the previous merge of the bus)
Git chekout bus/ XXXX 2. Git merge yourBranch 3
Tools:
Recommend beyondCompare, Kaleidoscope for MAC.
Kaleidoscope is a powerful file image and text comparison tool for Mac. It supports any text document and image file. It can quickly and accurately find differences and merge different documents or images. It also supports integration with Subversion, Git, Mercurial and other version management tools.
Working with Git requires some simple configuration.
- After installing kaleidoscope
- Then install the Ksdiff command line
- Once installed, select the Git options box and set KaleidoScope as the default Git diff and Merge tools
The installation is complete. Then replace git diff with git Difftool on the command line. For example, to diff with a local master, use Git DiffTool Master. Then you’ll notice that instead of the boring +++ – on the command line, it’s like going from quadratic to cubic.
Common Commands
- Git pull/push/fetch [remote]
- Git diff commit1 commit2 [– stat]
- Git log [-p] [–author= XXX] [filename]
- Git merge branch [–squash]
- Git commit -m [-n] [–author=other]
- Git reset hash [–hard]
- Git keyword [-l] keyword [filename]
Common tags:
Type indicates the type of commit. Only the following seven identifiers are allowed.
- Feat: New Feature
- Fix: Fixes bugs
- Merge: Merges branches
- Docs: Document modification
- Style: Indentation, Spaces, line breaks, capitalization, etc. (does not affect the code running changes)
- Refactor: code refactoring (code structure adjustment without affecting functionality)
- Perf: Improve Performance
- Test: Adds a test
- Chore: System construction, packaging
Some other tips
Git Stash: Multi-branch development
Git Stash list: Look at stash
Git Stash pop: Pop the first one
Git stash drop stash@{0} : Removes stash
Git Stash save “XXX” with name
Git stash show -p XXX: Check the diff difference
Cherry-pick: reset is used together with or pulls a commit submitted by others
Git cherry-pick git cherry-pick
www.ruanyifeng.com/blog/2020/0…
Idea reset before can record branch hash reset after can cherry pick before submit gitkraken benefit is graphical interface
Abbreviated shortcut keys :(ZSH command)
G: Git other commands should be typed
Recovery code:
As long as I can get my hands on the hash, I can restore it
git reflog
Git reset hash –hard
Git Stash Clear can also be restored