git is one of the most popular versions of the control program, and the text contains some basic git usage. Create a git repository initialize git repository mkdir project # Create projects Directory CD project # go into the project directory git init # initial Git repository. This command creates a new. Git directory in the current directory, which stores information about the GIT repository initialization and submission of the touch README git Add. # Add the current directory to the GIT repository using git add-A is to add all the changed documents git commit-M"Initial Commit"git remote add origin git @github. Com:lugir/Repo.git # Set up warehouse patching commits (patching last commit without creating a new commit) Git commit--amend-m"commit message."commit a conflict when you can merge and then push git pull # to get a remote repository commit to merge with a local commit git push # commit using someone else's repository git clone http://Path/to/git.git # Clone content will be placed in the new directory under the current directoryupload code back to the repository from the local git push-u Origin master uses git status to view file status Git Status View commit log git log # view commit info git log--pretty=Oneline # Displaying commit information in a neat single-line git branch git branch # view branching git branch6. x-1. x # Add Branch6. x-1. x git branch Checkout Master # switch to Main branch git branch-D6. x-1. x # Delete Branch6. x-1. x git push origin:branchname # Delete remote branch git tag git tag # view branch git tag6. x-1.0# Add tags6. x-1.0git show6. x-1.0# View Tags6. x-1.0information on git tag-A6. x-1.0965e066 # for previously submitted information record 965e066 tagged git push--Tags # Submit with tag information Git push origin:/refs/tags/tagname # Remove remote tags from git repository export project git archive--format Tar--output/path/to/File.tar Master # Some basic rules for using Git to package Master in tar format to specified files: When you want to commit/when submitting patches: Using Git diff--Check the end of the line there is no extra white space each commit changes only one thing. If a document has multiple changes, use git add--Patch selects only some of the changes in the document enter the stage to write the commit message clearly
Preliminary discussion on git git basic usage