git init turns the current directory into a manageable git repository and generates hidden .git files.
git add XX adds the xx file to the staging area.
git commit -m "XX" Commit file -m is followed by comments.
git status View warehouse status
git diff XX View XX files that have been modified
git log View history
git reset --hard HEAD^ or git reset --hard HEAD~ Go back to the previous version
(if you want to go back to 100 versions , use git reset --hard HEAD~100 )
cat XX to view the content of the XX file
git reflog to view the version number id of the history record
git checkout -- XX undo all the modifications of the XX file in the workspace.
git rm XX delete the XX file git
remote add origin http://git.fengqun.ltd/liucong/pizza.git associate a remote library
Push the branch to the remote library
git clone https://github.com/tugenhua0707/testgit Clone from the remote library
git checkout –b dev Create the dev branch and switch to the dev branch
git branch View all current branches
git checkout master Switch back to the master branch
git merge dev Merge the dev branch on the current branch
git branch –d dev Delete the dev branch
git branch name Create a branch
git stash Hide the current work and continue to work after restoring the scene
git stash list View List of all hidden files
git stash apply Restore hidden files, but the contents are not deleted
git remote View the information of the remote library git remote -v
View the detailed information of the remote library The content of the file has been modified git log View history vim .gitignore Add ignore file git check-ignore Check whether the ignore file command is correct : wq Save and exit VI command: q! Do not save and exit git log -p -2 View the last two detailed logs git reset --hard Repository overwrites local git pull back version: git reset --hard 139dcfaa558e3276b30b6b2e5cbbb9c00bbdca96 push to remote server
git push -f -u origin master
Migration address:
git remote set-url origin http://git.fengqun.ltd/fengqun/pizza.git
# Merge the b branch into the current branch
git merge b