Some basic commands on git usage

Turn this directory into a warehouse that git can manage by command git init

Some basic commands of git:

git remote ---------- connect remote warehouse

【1】Upload warehouse

git add . -------- Add files to the local warehouse temporary storage area

git commit -m 'project creation'-----submit files to the temporary storage area

git push -u origin "master" ---------- push to the remote warehouse

[2] Create a branch:

git checkout -b dev --------------- Create a branch called dev

git push -u origin "dev" ---------- push to the remote warehouse

[3] Check and switch branches:

git branch -------- check branch

git checkout dev -------- switch to dev branch

[4] Merge branch:

git merge branch name ---------- Merge another branch under the current branch

step:

Create a file under the master branch to write the content

Submit the master branch

Switch to the dev branch

Merge master under dev

[5] Version rollback:

git log ------- View all versions submitted

git log --pretty=oneline ------------ git log will show detailed information, use this to simply view the version number

git reset --hard version number------------------- version rollback

【6】Drop-down code:

git pull origin dev -------- pull down the code

【7】Code conflict:

First directly add commit push to submit the local ones to ensure that the local and remote warehouses are unified

Both local and remote modify the same location

local add commit

Execute pull directly

Solution: pull first, then push

[8] Warehouse cloning:

git clone SSH code

Guess you like

Origin blog.csdn.net/m0_57002951/article/details/124318927