GIT commands are numerous, and they are only recorded here. Go to picture town first. Git command and beyond Compare can be downloaded for free

To do a good job, he must sharpen his tools

Commonly used Settings

# set user information when submitting code,
$ git config [--global] user.name "[name]"
$ git config [--global] user.email "[email address]"
Let Git display colors to highlight new files, changed files, etc
$ git config --global color.ui true

Copy the code

Set up aliases to make Git more efficient

$ git config --global alias.st status
$ git config --global alias.co checkout
$ git config --global alias.ci commit
$ git config --global alias.br branch

Copy the code

Set DiffTool and MergeTool to make Git fly

1. Start Beyond Compare, go to the Beyond Compare menu, and run the install command line tool. 2. Specify diffTool $git config --global diff.tool bc3 3. Specified in the terminal mergetool: $git config - global merge. The tool bc3 $git config - global mergetool. Bc3. TrustExitCodetrue
Copy the code

use

 $ git difftool file.ext
 $ git mergetool file.ext
Copy the code

$git config –list Command + Shift +. $git config –list Show the hidden files in Finder and then look like my computer at /Users/zhulk/.gitconfig

The next step is to check out or upload the code (before git is associated).

// Download the master branch $git by defaultclone[url] // Check out the specified remote branch $gitclone$git remote add origin [url] $git push -u origin masterCopy the code

1. Stash Stash area. When we are halfway through the project, the boss suddenly comes with other needs or bugs. Common instructions are as follows:

$git stash pop / $git stash applyCopy the code

A branch project involves building different branches, including the integration branch, feature branch, and repair branch, named Develop, Feature, and hotfix, respectively. Common commands:

$git branch $git branch $git branch $git checkout -b dev // checkout the existing master branch $git checkout master // merge the dev branch to the master branch $git merge dev // delete the dev branch $git branch-d dev
Copy the code

3. Complete the submission process once, then play with your friends once, pull and submit the code back and forth

$git add. $git commit -m"Comment"$git push ⚠️ If the push fails, hint: $git pull ⚠️git pull fails because the tip of your current branch is behind There is no tracking informationforThe current branch is not associated with the remote branch. Git cannot trace the current branch. You need to set the link as prompted, such as local dev and origin/dev. $git branch --set-upstream dev origin $git branch --set-upstream dev origin Add -commit-push $git pushCopy the code

4. The git pointer generates a commit ID for each commit and points to the current commit. If we overwrite someone else’s code, or commit something wrong, we can change the commit ID to rollback the code, or point to a commit. Common commands:

$git $git $git $gitlog$git reset --hard [commId]Copy the code

Generally stable, after each release will tag, convenient to find later, modify unknown bugs, etc.

$git tag $git tag $git tag-dV0.1 // Push tags to remote $git push Origin v1.0Copy the code

At the end, if you’re not used to the command line, of course you can also use visual tools such as the common ones

sourcetree tower

resources

Links to download git quick table: pan.baidu.com/s/1F0DLQ29U… Huw password: 1

Beyond Compare crack download links: pan.baidu.com/s/1n8siuZpD… Password: 80 t8

If there are any omissions, please point out and appreciate it. If you have any questions, please contact me through the following ways

CSDN Nuggets klvens running yard