Learning git for about two weeks, the brain is a little dry, you can come up with a summary:
git, for version control, was just beginning to think it was the default command under Linux, but it's also a tool that needs to be installed Apt-get install git.
There are a lot of commands, I will only have some common, other people need git--help view first-class parameters, and then git parameter 1--help basic can see all the commands you want to use, usually I learn, although it is English but does not hinder the look.
git log View the most recent commit log under this sub-branch.
git branch see where this branch is located and list all the branches.
git branch -m | -M oldbranch newbranch Rename the branch, if the Newbranch name branch already exists, you need to use-m to force the rename, otherwise, use-M to rename.
Git branch-d | -D branchname Delete Branchname Branch, note:-D and-D have a different look at the Help information
Git branch-d-R branchname Remove remote Branchname Branch
git add adds modified content to the repository in your branch
git checkout
git checkout Branch a switches to branch a
git checkout-b branch B new branch B and switch to branch B
Git checkout-f removes modified files, and when git fetch conflicts, it uses more
git pull updates to the nearest branch (typically done on the master branch)
git rebase master lets you add the newest stuff from the master branch to the current branch, with Git pull
git diff makes the changed file diff with the original, showing the difference
git diff--cached when you git add changed files, but not yet commit this time the command can see the differences between the old and new files
git show displays the diff out file after the commit
git stash is temporarily saved as a commit, or you git add, but you can't switch branches and then use Git statsh the Apply ID number to restore
To be Continued ...
Write tired of the spirit of the picture, hehe ...
Workaround for git push failure
Assume that the action is performed:
1. Modify the Code
2. Git commit
3. Git push
A, push fails at this time (Error message:!) [Rejected] master, Master (Non-fast-forward))
Workaround:
$ git pull
If successful, then:
$ GIT push origin Master:your-id
b, if it appears:error: unpack failed: error Missing tree 30c4809ade0b4b0c81cb7f882450774862b82361
Workaround:
Pushing with --no-thin
argument works as a workaround for me
Such as:git push --no-thin omnigerrit HEAD:refs/for/android-4.4
The reason for this issue is as follows: (You can git push--help to see it)
This happened to me when trying to push a new patch set to an existing review where the only change is in the commit mess Age. Making a small change in one of the files and pushing that is successful as a work-around for me
git Phase Learning Summary