1. Submit push
process
- Check the file to submit
- Fill in the submission instructions
- When you want to submit a direct push to the repository, check the lower left button
- Finally, click the submit button to complete the code push
Is equivalent to
Git add index.html git commit -m "feat(index): add index.htm homeCopy the code
2. Storage area
use
- The cache saves all uncommitted changes (both temporary and non-temporary) when you want to keep your workspace clean
- Cache workspaces when you have another piece of content that needs to be modified but don’t want to throw away the content that has already been modified
- When you want to push code, you find that the branch has already been submitted and when the code is behind the branch, you can temporarily store the code and then pull it up to date and when the code is pulled and there are no conflicts you can apply the contents of the repository to the current workspace
Is equivalent to
Git stash save 'development' git stash list check out the list of stash stash apply // Apply the latest stash (do not delete the stash after the application) Git stash drop You can specify how to manipulate any stash by following it with the stash@{1} index. Enter git Stash list to see the indexCopy the code
3. Rollback version
use
- When an error is accidentally pushed to a remote repository and the code wants to be rolled back without leaving a version record
- Select the version you want to fallback to and click Reset to commit. The local version will be reset to that version and behind the remote branch
- Finally, use the command line to force push
git push --force origin master
, forcing local code to be overwritten to a remote repository
Is equivalent to
Git reset --soft HEAD^ git reset --soft HEAD^ Git push --force origin master // force the remote repository to be overwrittenCopy the code
3.2 Rollback version (do not use force, safe way recommended!)
use
- Without using
force
Version rollback is performed when push is forced - Check out a new branch by selecting the location to roll back to
merge
- The new branch
merge
Reset to themaster
The latest location of the branch commit - Records to be rolled back are written locally and the version can be rolled back by committing again
Is equivalent to
Git checkout -b merge 3d7fa42 // create a new branch at the specified location. // Commit the deleted record again to roll back the versionCopy the code
4. Commit rollback
use
- You can use commit rollback to roll back the current committed version before this commit and keep the commit
- Select the version you want to roll back and click Commit Rollback. The local branch will be rolled back to the state before the commit, and the rollback will be treated as a commit and ahead of the remote branch
- The last push code completes the rollback of the remote warehouse commit record and retains the rollback to the record
Is equivalent to
Git revert HEAD -n git commit -m 'Rollback this commit' git pushCopy the code
5. Version Tag Record
use
- You can label versions when you release phased versions
- Select the version to be labeled, click the label, and the setting window to be labeled will pop up. After selecting push label, the label will be pushed to the remote warehouse, otherwise, the label will only exist in your local warehouse
- Delete labels You can delete labels that have been added
Is equivalent to
Git tag v1.0.0 git tag v1.0.0 git tag v1.0.0 1452113 git tag v1.0.0 Git tag -d v1.0.0: // create a git tag with the name 'v1.0.0' for the commit record with version 1452113 **** : // create a git tag with the name 'v1.0.0' for the commit record with version 1452113 Git origin :refs/tags/v1.0.0 git origin :refs/tags/v1.0.0Copy the code
6. Create a branch
use
- When a branch is created, it creates branches based on the current branch
- Check the
Working copy parent node
To create a new branch on the latest version of the current branch, checkSpecified commit
You can select the version record location when the new version is created - Check the
Check new branch
You can switch directly to the new branch created after the version is created
Is equivalent to
Git branch dev d519940 git branch dev d519940 Git checkout -b dev // git branch -d dev Git branch -d dev -d dev -d git branch -d dev -d dev ****** ******** git push origin dev:dev // Git push --delete origin dev // delete remote dev branchCopy the code
7. Merge branches
use
- After committing the dev branch, if you want to merge to master, switch the local branch to Master first (double-click on the branch name to do so).
- To merge to the branch, you must first switch to the branch
Is equivalent to
Git merges the de branch to the master branchCopy the code
8. Pull branches
use
git fetch
Fetching remote updates back locally does not have any impact on merging workspace codegit push
Push local branch updates to remote- The pull operation is used when all items are not selected by default
git pull --no-commit
--no-commit
After a parameter is pulled into a merge, in case the merge fails and is not automatically committed, the user is given an opportunity to review and modify the merge results before committing--no-ff
Do not merge branches in fast-forward mode, and keep the commit history of branches--rebase
Use base changes instead of merges (see below)
Rebase rebase
The operation of Git pull itself is to grab remote updates and merge them with the local branch, which is divided into merge and rebase. Git pull is the same as git fetch + git rebase
Merge pull merges when you have a commit not pushed but the release is behind, and creating a Merge commit results in unnecessary merge commits and incoherent commit lines. When you merge with the rebase operation, it moves your branch behind the master branch and merges new commits from the Master branch before your commit, so that the commit line becomes a coherent line. See Git branch – Rebase or Rebase
Is equivalent to
Git fetch git fetch git fetch git fetch git fetch Git pull --no-commit // Pull the remote update to merge it locally using 'git merge'. Git pull --no-commit --log git pull --no-commit --no-ff git pull --no-commit --rebase Rebase methods are incorporated locallyCopy the code
9. Operate the remote branch
use
- When the remote list is expanded, all remote branches in the remote repository are displayed
- Select a branch, right-click and select
Check out the
, the remote branch can create a branch locally, and you can choose whether to trace the remote branch in the follow-up dialog box (after tracing the branch, push or pull will be automatically pushed or pulled to the associated remote branch). - choose
pull
Function, you can update and merge the remote branch to the current local branch - choose
delete
, you can delete the remote branch from the remote code repository
Is equivalent to
Git branch -r git checkout -b dev --track origin/dev // create a local branch named 'dev' for the remote 'dev' branch, ******** git branch -r -d origin/dev git push origin :devCopy the code
10. View the modification history
use
- Right-click on the selected file
View the selected change log
You can view the commit record in the current version and all previous versions - The visual interface makes it easy to compare modified version records of files
Is equivalent to
Git log -p index. HTML git log -p index. HTMLCopy the code
11. Cherry-pick version merge
use
- You can use cherry-pick when you want to merge one or more records from one branch to another because there are other commits on the branch that you want to merge and you don’t want to merge them all together.
- Switch to the branch you want to merge, then select the version you want to merge from the version record (you can merge more than one version), right-click and select
The selection
- use
The selection
, it is best to merge in the order of submission. If you skip the previous version and choose the later version, you may cause file conflicts, but you can still submit the push after manually resolving the conflict
Is equivalent to
Git cherry-pick 905a563 git cherry-pick 905a563 git cherry-pick 905a563 git cherry-pick 905a563Copy the code