Git使用

来源:互联网 发布:js字符串match的用法 编辑:程序博客网 时间:2024/06/05 07:26

 

git init (first time)

git add –all

git status

git commit –m”test”

 

git remote add origin https://.../*.git (first time)

git push origin master (need executetwotimes, the first time will be error, why?)

 

当多人编辑时,Updates were rejected because the tip of your current branch is behind

its remote counterpart. Merge the remote changes (e.g. 'git pull')

 

 

TortoiseGit:

1.       右键选”Git-Commit -> master…”,按OK。成功后按push按钮。如果不能push,可能是冲突,如下操作:

2.       右键选TortoiseGit,按Pull

3.       右键选TortoiseGit,按Push

 

egit:

1.       commit:

Team -> Commit

2.       merge(rejected - non-fast-forward: need to merge)

Team -> Pull

Team -> Merge Tool

Team -> Add to index(再次将文件加入索引控制,此时文件已经不是冲突状态)

Team -> Commit

 

 

.gitignore文件过滤有两种模式,开放模式和保守模式
1. 开放模式负责设置过滤哪些文件和文件夹
例如: /target/ 表示项目根目录下的target文件夹里面所有的内容都会被过滤,不被GIT 跟踪
.classpath 表示项目根目录下的.classpath文件会被过滤,不被GIT跟踪


2. 保守模式负责设置哪些文件不被过滤,也就是哪些文件要被跟踪。
例如:
!/target/*.h 表示target文件夹目录下所有的.h文件将被跟踪


关于TortoiseGit的使用可以参照:

http://www.cnblogs.com/zhaojin/archive/2012/03/29/2423248.html

 

 

原创粉丝点击