1. Download the server version:
Repo init-u git@192.168.1.11: i700t_60501010/platform/manifest. Git-B froyo_almond-M m76xxtsncjnlya60501010. xml
Repo sync
Repo forall-C git checkout -- track origin/i700t_60501010-B [your local branch]
Or:
Git clone git@192.168.1.11: 6120_gingerbread/Arm9-6120.git
Git checkout -- track origin/arm9_6120-B [your local branch name]
2. Synchronization of the server's new warehouse:
Follow these steps to obtain the lanucher_wpon code:
1: ~> CD i700t/. repo/manifest
2: i700t/. repo/manifest> git pull -- rebase
3: i700t/. repo/manifest> CD ../..
4: i700t> repo sync platform/packages/apps/launcher_wpon
5: i700t> Cd packages/apps/launcher_wpon
6: i700t/packages/apps/launcher_wpon>
7: git checkout -- track origin/froyo_almond-B [your local branch]
3. upload local modifications to the server
Repo forall-C git add.
Repo forall-C git reset -- hard
Repo forall-C git pull -- rebase is synchronized with the server (this operation is generally performed before the code is uploaded)
Git Add. Or git add file name Add File Modified by current Repository
Git commit-M "..." add your modification record in quotation marks
Git push origin local branch name: froyo_almond upload locally modified code
4. Set some default global variables, which are valid for all project codes.
Git config -- global user. Name yourmail
Git config -- global user. Email yourmail
Git config -- global push. Default tracking. In this way, parameters are not required for subsequent git push.
5. View modification records
Git log local repository modification records
Repo forall-C git log -- since = "2011-04-19" -- until = "2011-04-21" view all repository modification records of the project by conditions
Repo status: view the modification status of all repositories in the project (including file locations)
Git Status view repository modification status
6. Branch-related
Git branch view local branch
Git branch-r view remote Branch
Git branch-a view all branch
Git branch-D (-d) (branch name) delete Branch
Cat. Git/config can view some local branch Information
7. Modification and recovery
Git checkout filename1 filename2... cancel local modification and synchronize with the server
Git stash
Git stash apply first stash local modification, then execute git pull -- rebase synchronization, and then apply to restore the modification.
Git reset -- soft head_commit restore to the last commit, keep the code modified
Git reset -- hard commit restore to the specified commit, discard all previous modifications
# Roll back the version of the file a. py to the previous version.
Git reset head ^ A. py
Git reset commitno filename
8. If a problem occurs in a local warehouse, delete it and Re-Sync the tracking.
Project_folder/vendor/qcom $ Rm-RF proprietary/enter the corresponding directory and delete it
Project_folde $ repo sync platform/vendor/qcom/proprietary re-repo sync. You can view the following path names:
Gedit. repo/manifest. xml
Git branch-a ---- list all branch
Git branch-D 700_arm11_server
Git branch-D 700_arm11_server_wifi -- delete all local branch
Git checkout -- track origin/froyo_almond-B 700_arm11_server then track remote branch and recreate local branch
9. Use of tags
Git tag [tag_name] [version]. In the corresponding version (Change sha1 is generally used), create a tag
Git tag-l list current tag
Git tag-d [tag_name] Delete tag
With the tag, you can use git checkout [tag_name]-B [branch_name] to check the code of the corresponding tag moment. You can also use the tag name to implement diff and other functions.
10. Patch usage
Git diff filename1 filename2... modify the location comparison and view the source code
Git diff> XXX. Patch: compress the modification into a patch.
Git apply XXX. Patch
11. Continue to add useful commands
Git revert revokes a commit. Git reset-hard is returned to the previous version
Git reset -- soft commitnum is used to save the reset for code modification. However, you cannot use git diff to compare and modify the files. It must:
Git reset filename so that you can view git diff
Git diff ffd98b291e0caa6c33575c1ef1_eae661ce40c9 b8e7b00c02b95b320f14b625663fdecf2d63e74c view the differences between two versions
Git diff ffd98b291e0caa6c33575c1ef1_eae661ce40c9
Git command alias
$ Git config-Global alias. CO checkout // CO is the alias of checkout.
$ Git config-Global alias.br Branch
$ Git config-Global alias. CI commit
$ Git config-Global alias. St status
$ Git config-global user. name "username"
$ Git config-global user. Email username@mail.com
12. gitk usage
Gitk & allows the terminal to continue writing and executing commands
The gitk file name allows you to view the modification records of a file.