1.git diff + filename
2.git log
3.git diff 查看修改情况
4.git reset filename
5.Git enables you to rewind to the part before you made the wrong turn and create a new destiny for the project. You can do this with:
git reset SHA
This command works by using the first 7 characters of the SHA of a previous commit.
For example, if the SHA of the previous commitis 5d692065cf51a2f50ea8e7b19b5a7ae512f633ba, use:
gitreset 5d69206
6.git checkout HEAD filename
: Discards changesin the working directory.
git reset HEADfilename: Unstages file changes in the staging area.
git reset SHA: Can be used to reset to a previous commit in your commit history.
7.Additionally,you learned a way to add multiple files to the staging area with a single command:
git addfilename_1 filename_2
8. You can use the command below to answer the question:“which branch am I on?”
git branch
9. To create a new branch, use:
git branch new_branch
10. You can switch to the new branchwith
git checkout branch_name
11. We can easily accomplish this by merging the branch into masterwith:
git merge branch_name
12.
git branch -d branch_name
will delete the specifiedbranch from your Git project.
13.
it clone remote_location clone_name
In this command:
· remote_location tells Git where to go to find theremote. This could be a web address, or a filepath, such as:
/Users/teachers/Documents/some-remote
· clone_name is the name you give to the directoryin which Git will clone the repository.
14.
You can see a list of a Git project's remotes with the command:
git remote -v
15.An easy way to see if changes have been made to the remote and bring the changes down to your local copy is with:
git fetch
This command will not merge changes from the remote into your local repository. It brings those changes onto what's called a remote branch.
16. Now we'll use the git merge
command to integrate origin/master
into your local master
branch. The command:
git merge origin/master
17.
git push origin your_branch_name
will push your branch up to the remote, origin
.