How to check git version

View the current version number through the command line

How to view git log in one line

The git log information is compressed into one line through a simple parameter. When using git to view the log, a large piece of information will be displayed. By formatting the log, the readability of the log can be improved, and the screen occupation can also be greatly reduced.

How to discard all local changes in git

In daily development, if you want to quickly discard all the modified content after modifying multiple files, you can discard the local modifications through the following git command. Come and learn.


How to stash changes in git

When you do some work on a branch, but need to switch branches to do some work, but don't want to commit the current changes, you can try this command, save the unfinished changes to a stack, you can do any time at any time. Enable these changes on the branch.

How does git create empty commit

When using git to manage code, every time you submit code, you need to change the file to submit. Sometimes when we need to trigger some operations by submitting, we can also try to create an empty submission to achieve this purpose.

How to switch branche in git

When using git to manage code, multiple branches are usually created, usually the default is the master branch, we can use this command to switch to the branch2 branch

Git checkout file from another branch

When using git to manage code, multiple branches are usually created. We pull files from other branches, which can be achieved through git's checkout, and only need to specify the branch and file name. In this example, we pull the file of the branch1 branch under the master branch

How to delete file in git

When using Git to manage code, you can delete files by rm. For example, we delete the file in the current code. After use, the file will be deleted from the file system and the warehouse.

How to undo add file in git

When using Git to manage code, you may encounter the following scenarios. The file has been successfully added through git add, and you want to undo this operation. You can use git restore to achieve this operation. In this example, we implement the undo operation on the file that has been successfully added by git

How to view git commit history

When using git to manage code, if you want to view historical submissions, you can view the history of submissions through git log

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.