git to download the official website: https://git-scm.com/downloads
1. cloning project, the project to a local remote pull
Any find an open source project, copy the connection:
I chose to link https mode:
Cloning main branch master:
git clone https://gitee.com/xxx.git
Clone designated branch dev:
git clone https://gitee.com/xxx.git
After the press enter, you need to enter the account password. If you do not remember the password is set, every time input, you can use this command:
git config --global credential.helper store
2. Submit to the staging area
Submit a new document (new) and is modified (modified) file, not including deleted (deleted) files
git add .
Submit all changes
git add -A
Submit been modified (modified) and is deleted (deleted) files, the new file does not include the (new)
git add -u
3. The temporary area where changes to be submitted to the local repository
the commit -m git " modify description "
Then, on top of me performing the operation, I want to withdraw the version submitted to the local repository, then step back to the staging area , then do the following:
View your history and find the version you want to roll back. History follows
git log
Specifies the fallback local version submitted
git reset --soft 72bd6304c3c6e1cb7034114db1dd1b8376a6283a
I just want to return to the local version does not need to save the contents of the staging area:
git reset –hard 72bd6304c3c6e1cb7034114db1dd1b8376a6283a
The difference between soft and hard argument is, hard to modify records gone, soft will modify records retention.
4. pushed to the remote
You can check the next good and did not submit it modify
git status
After some agonizing, I decided to push to the remote, and then they would execute:
Push up:
git push
I wrote the code for some time, going to push up, then pull down the first merger:
git pull
After the re-implementation of the temporary above, submit, push
5 setting does not need to upload files
Adding to the project .gitignore
.gitignore can ignore you do not want to upload files such as doc, target, classes, etc.
.Gitignore only need to add the file in the same directory .git, then do not need to add the last of the directory can be, for example,
#zzzili Logs/ *.zip v15/ .gitignore Infrastructure/DPO.Utility/obj/Debug/
Remove excess files have been uploaded
If you add .gitignore time, git which have uploaded a lot of unwanted files, use the following two commands to kill them
if a folder:
git rm -r --cached folder name
If the file:
git rm --cached file name