source: gitrepo/README

Last change on this file was 2e14cda, checked in by tangm <tangm@…>, 10 years ago

add some git operations to README

  • Property mode set to 100644
File size: 1.6 KB
Line 
1This is a git project only used for test.
2
3Git Web Browse
4http://ccode.ihep.ac.cn/git
5
6I. Git Configure
71. Needed
8        git config --global user.name 'yourname'
9        git config --global user.email 'yourname@email.server'
102. Optional
11        git config [--global] core.editor vim
12        git config [--global] core.paper 'less -N'
13        git config [--global] color.diff true
14        git config [--global] alias.co checkout
15you can use 'git var -l' to list git configure.
16
17II. Clone Remote Repository to Local
18        git clone git@ccode.ihep.ac.cn:git-test-project.git
19
20III. Commit to Repository
210. Show modified file
22        git rm file
23        git ls-files -m
24
251. Add changes
26        git add .
27
282. Commit to Local Repository
29        git commit -a -m 'your commit message'
30or
31        git commit -a -e
32
333. Push to Remote Repository
34        git push
35or
36        git push origin master
37
38
39IV. Update Local Repository
401. List remote repositories
41        git remote -v
42
432. Get latest version from remote to local
44        git fetch [repository] [branch]
45Exmaple:
46        git fetch origin master
47It means download updates from master branch of remote origin repository
48to master branch of local origin repository
49
503. Compare differences between local and remote repository
51        git log -p master.. origin/master
52
534. Merge remote to local
54        git merge origin/master
55
56V. Local Branch
571. List remote branches
58        git remote -v
59
602. Check out remote branch as a new branch to local
61        git fetch origin master:temp
62
633. Compare differences between origin branch and local branch
64        git diff temp
65
664. Merge other branch to master branch
67        git merge temp
68
695. Delete branch
70        git branch -d temp
71You can force to delete a branch withou merging to master branch:
72        git branch -D temp
73
74 
Note: See TracBrowser for help on using the repository browser.