Git summary

Time:2020-1-17

1.1 git Usage Summary

1.2 git introduction

Powerful and free distributed version control system.

Originated from the Linux community, in order to meet the needs of Linux developers around the world for code version management

GitHub / gitlab is essentially an online code hosting website based on Git

1.3 general operation of GIT

Git summary

Start work every day, you must pull the code first

Pull the code before each submission

Git add and. Gitignore

The GIT add command is used to add the specified file / folder to the staging area. Generally, you can use git add. To add the current directory to the staging area. During the addition process, GIT ignores the exception files / folders specified in. Gitignore by default. . gitignore configuration syntax is as follows:

Git summary

The beginning indicates a comment. The path relationship needs to compare the location of the target and the. Gitignore file

Git reset head and git RM

It is easy to understand that git reset head can be used to clear the temporary storage area, which is the reverse operation of GIT add.

The GIT RM command is used to delete files from the cache or working directory. –The cached parameter can be used to specify the branch name / specific file name, which means that only files are removed from the cache and local source files are reserved.

Git pull and git push

Git pull can be regarded as the merge command of GIT fetch and git merge. It is equivalent to executing git fetch origin and git merge fetch head to get the code of the specified branch on the server and merge with the local code. It is recommended to write full commands such as: git pull origin dev: dev

Git push, full write: git push origin dev: dev, command format is git push origin < local branch >: < remote branch > version rollback (risky!)

Git log – 5 or git reflog view the latest 5 commits / all commits, select the version to roll back, and copy the version number

Git summary

Run git reset — hard ee6332c4cf3a05c600f5ab02077104b9d496cca1 to roll back to the specified version (local warehouse). Run git push – f origin master: master to force submission to the remote warehouse. ! > the GIT reset command with the — hard parameter is dangerous. It can overwrite the local code and cause work loss, so it should be used with caution.

Git FAQ

! [rejected]… (non fast forward) method 1: git pull origin master — allow unrelated histories method 2: git fetch origin master, GIT merge fetch - head

cd existing_folder git init git remote add origin

git.definesys.com/tl/saas_dragon_wx.git

[email protected]:tl/tulong.git

git add . git commit -m “Initial commit” git push -u origin master

Add new branch git fetch origin SaaS git checkout – B SaaS origin / SaaS

My entrepreneurial team product, madpecker, is mainly engaged in bug management, test management and application distribution

Website: www.maddecker.com, welcome to try and experience if you need!

This article is written for technicians of madpecker team. Please indicate the source for reprint

Recommended Today

Some suggestions on improving query efficiency by SQL

1. If you want to use subqueries, use exists instead of in and not exists to replace not in. Because the subquery introduced by exists only tests whether there are rows that meet the specified conditions in the subquery, which is more efficient. In either case, not in is the most inefficient. Because it does […]