- git config --global user.name "username"
- git config --global user.email "mailbox"
- pwd shows the current directory
- get init turns the current directory into a repository that git can manage
- git add "filename" adds files/folders to the repository, you can add multiple files separated by spaces
- git commit -m "commit information" tells git to submit the file to the repository, but first execute the git add command on the file
- git status Get the current status of the repository
- git diff "filename" to view the modified content of the specified file
- git log View the log, you can add the suffix --pretty=online
- git reset --hard HEAD^ Go back to the previous version, the current version of HEAD, the previous version of HEAD^, the previous version of HEAD^^, and the commit id can also be used.
- cat "filename" opens the current document
- get reflog View operation records
- git diff HEAD -- "filename" to see the difference between the workspace's document and the latest document in the repository
- git checkout -- "filename" Undo changes to the workspace and replace the workspace files with the latest files from the repository
- git reset HEAD "filename" to undo the changes in the staging area
- rm "filename" deletes the file in the file manager
- git rm "filename" removes this file from the repository, then commits using the command git commit
- ssh-keygen -t rsa -C "mailbox" requires the email address verified in GitHub
- git remote add origin [email protected]:yourGitHubUsername/yourProfile will associate the remote repository locally
- git push -u origin master pushes the current master branch to the remote repository, -u associates the local branch with the remote branch
- git clone [email protected]:yourGitHubUsername/yourProfile clone from remote repository to local
- git checkout -b dev creates a dev branch, -b means create and switch to dev
- git branch View current branch
- git checkout master switches to the master branch
- git merge dev merges the dev branch into the current branch
- git branch -b dev delete the dev branch
- git merge --no-ff -m "commit information" dev --no-ff forcibly prohibits Fast forward, merge branches and delete branches without losing branch information
git command line operation instructions
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325590707&siteId=291194637
Recommended
Ranking