git-command(GIT命令)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1.
svn checkout /repos/jbosstools/branches/jbosstools-3.2.0.Beta1/
git clone /sonatype/sonatype-tycho.git; cd sonatype-tycho; git checkout origin/tycho-0.10.x
2.
svn update
git pull
3.
svn stat
git status
4.
svn diff somefile.txt
git diff somefile.txt
5.
svn revert somefile.txt
git checkout somefile.txt
6.
svn revert . -R
git reset --hard HEAD
7.
svn add file.txt
svn add folder
git add file.txt
git add folder
8.
svn rm file.txt
svn rm folder (recursive by default; use -N to not recurse)
git rm file.txt
git rm -r folder (non-recursive by default; use -r to recurse)
9.
svn ci -m "message" file.txt
git commit -m "message" file.txt; git push
10.
svn propset svn:ignore "target
*.class
bin" .; \
svn ci -N -m "svn:ignore" .
echo "target
*.class
bin" > .gitignore; \
git ci -m "gitignore" .gitignore
11. branch
/book/en/v2/Git-Branching-Basic-Branching-and-Merging
12. tag
/book/en/v2/Git-Basics-Tagging
13.
svn info
git remote -v
14. 本地冲突,如果希望保留生产服务器上所做的改动,仅仅并入新配置项, 处理方法如下:
git stash
git pull
git stash pop
然后可以使用git diff -w +文件名 来确认代码自动合并的情况.
15. 如果希望用代码库中的文件完全覆盖本地工作版本
git reset --hard
git pull
其中git reset是针对版本,如果想针对文件回退本地修改,使用
git checkout HEAD file/to/restore
16. Changes to be committed
use "git reset HEAD ..." to unstage
17. Unmerged
git reset HEAD ...
git add ...
18 Changes not staged for commit
use "git add ..." to update what will be committed
use "git checkout -- ..." to discard changes in working directory
19 Untracked files
use "git add ..." to include in what will be committed
20 git mergetool (diff tool)
21. git rebase
/wangjia55/article/details/8776409
/hudashi/article/details/7664631
/kym/archive/2010/08/12/1797937.html
/sinojelly/archive/2011/08/07/2130172.html
22. List Git commits not pushed to the origin yet
git log origin/master..master
23. what is origin
$ git remote
origin
$ git remote show origin // svn info
24. Merge the master to a branch
git checkout feature1
git rebase master
=======
You can't merge with local modifications. Git protects you from losing important changes. You have three options. One is to commit the change using
git commit -m "My message"
The second is to stash it. stashing acts as a stack, where you can push changes, and you pop them in reverse order.
To stash type:
git stash
Do the merge, and than pull the stash:
git stash pop
The third options is to discard the local changes using git reset --hard.
===工作方法===
git checkout -b working #create and switched to a new branch
#git add .
git commit -a -m "" # 提交到本地
git commit . -m "add adm push support" # don't want

to commit untracked file

git checkout master
git pull origin master #切换回默认分支,并将默认分支和中央最新版本合并, 如果没有冲突,它会merge并创建一个commit
git merge working #在本地合并你的这次修改到默认分支
git push origin master #提交到中央版本库,接下来还是要切换回工作分支的
git checkout working
git rebase master # merge master to working

相关文档
最新文档