This is the first day of my participation in Gwen Challenge


One: Create a warehouse

Git setup identifier

Git config –global user.name git config –global user.name

Git config –global user.email

PS: PWD Displays the current directory

Initialize the warehouse

​ git init

Commit files to the repository

Git add.

Git commit -m

PS:git status Displays the changes that have not been committed

Git diff :git diff

Submit modification as submit file

Two: Version rollback

Git log Displays historical records

Git log –pretty=oneline

Git reset –hard HEAD back to previous version

Git reset –hard HEAD~100

Git reflog gets all previous version numbers and operation information

Git reset –hard Version Rollback using the version number

Four: undo modify and delete files

Git checkout — File name discards workspace changes

1. If the changes are not put in the staging area, undo the changes and return to the same state as the version library

2. After modification, put it into the temporary storage area, but modify it again, and return to the state of adding the temporary storage area after cancellation

Git checkout — git checkout — git checkout — git checkout

Five: remote warehouse

Ssh-keygen -t rsa -c “email” Creates an SSH public key

Cat ~/. SSH /id_rsa.pub View your public key

SSH -t [email protected] For connection

Six: Clone Project

Git clone “SSH address”

Git remote add origin git remote add origin

Git pull –rebase origin master

Seven: Git control repository

Git clone [email protected]:git clone

2. Modify

Git remote add origin gitee.com/yachunli123… Connecting a remote warehouse

Git push origin master commit changes

Git branch -a Check the current remote branch

Git checkout Origin/XXX

Git branch XXX Creates a local XXX branch

Git checkout XXX selects the newly created branch.

Git push Origin dev2 adds the changes to the new branch

Git status (check local branch files to make sure there are no conflicts when updating them)

Git branch

Git Checkout remote branch git checkout remote branch

git pull 
Copy the code

Git chechout aaa Switch branches. Git branck AAA Create an AAA branch. Git chechout -b aaa Create an AAA branch locally and switch to an AAA branch. A branch is created on the server only at commit time

Create and merge branches

Git checkout -b dev create the dev branch and switch to the dev branch

Git branch Displays the current branch

Git merge dev Merge branch

Check out the branch: Git Branch

Git branch name

Git checkout name

Git checkout — b name

Git merge name: git merge name

Git branch -d name