Get git repository
Initializing a repository of repositories
Git init
Clone Remote Repository
git clone [email protected]:wordpress.git
Add remote repository origin, syntax for git remote add [shortname] [url]
git remote add origin [email protected]:wordpress.git
View Remote repositories
Submit your changes
Add the currently modified file to staging area
git Add.
If you automatically track files, including files that you have manually deleted, the status is deleted
Git add-u
Submit your changes
Git commit–m "Your comment"
Push your updates to a remote server with the syntax git push [remote name] [local branch]:[remote branch]
Git push Origin Master
View file status
git status
Track new files
git add readme.txt
Remove files from the current trace list and remove them completely
Delete only in staging area, keep files in current directory, no longer track
Renaming files
View the history of a submission
Modify the last commit comment, using the –amend parameter
Forgetting to commit some changes, the following three commands will only get one commit.
Git commit–m "Add readme.txt" git add readme_forgottengit commit–amend
Let's say you've already used git Add., add the modified files A, B to staging area
Now you just want to submit a file, do not want to submit B file, should
git reset HEAD b
To cancel the modification of a file
Git checkout–-readme.txt
Basic Branch Management
Create a branch
Switch working directory to iss53
Combine the above commands together to create a ISS53 branch and switch to ISS53
Merge iss53 branches, current working directory is master
After the merge is complete, there is no conflict, delete the ISS53 branch
Pull data from remote repository, syntax for git fetch [remote-name]
Fetch pulls up the latest remote repository data, but does not automatically merge to the current directory
To view information about a remote warehouse
Establish a local dev branch to track the develop branch of the remote repository
Resources
Use of remote warehouses
What is a branch
Basic branching and merging
Management of Branches
Branching workflow
Remote Branch
Yan He
Git Command Summary