**********第五步:加载项目文件到本地Git工作空间.
将创建的测试项目git拷贝到D:/ilucky/git/core目录下,执行如下指令将项目加载到本地的Git工作空间.
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (master)
$ git add .
warning: LF will be replaced by CRLF in git/.mymetadata.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in git/WebRoot/META-INF/MANIFEST.MF.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in git/WebRoot/WEB-INF/web.xml.
The file will have its original line endings in your working directory.
**********第六步:提交已加载到本地Git工作空间的项目文件.
提交时通常都写上注释,例如:用test来作为第一次提交的注释,
提交完成后,随时可以回滚到这个状态,另外如果你需要检查Git的状态,你可以通过git status指令查询.
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (master)
$ git commit -m "test"
[master (root-commit) b8b6476] test
warning: LF will be replaced by CRLF in git/.mymetadata.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in git/WebRoot/META-INF/MANIFEST.MF.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in git/WebRoot/WEB-INF/web.xml.
The file will have its original line endings in your working directory.
14 files changed, 171 insertions(+)
create mode 100644 git/.classpath
create mode 100644 git/.mymetadata
create mode 100644 git/.project
create mode 100644 git/.settings/.jsdtscope
create mode 100644 git/.settings/org.eclipse.jdt.core.prefs
create mode 100644 git/.settings/org.eclipse.wst.common.component
create mode 100644 git/.settings/org.eclipse.wst.common.project.facet.core.xml
create mode 100644 git/.settings/org.eclipse.wst.jsdt.ui.superType.container
create mode 100644 git/.settings/org.eclipse.wst.jsdt.ui.superType.name
create mode 100644 git/WebRoot/META-INF/MANIFEST.MF
create mode 100644 git/WebRoot/WEB-INF/classes/com/ilucky/git/User.class
create mode 100644 git/WebRoot/WEB-INF/web.xml
create mode 100644 git/WebRoot/index.jsp
create mode 100644 git/src/com/ilucky/git/User.java
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (master)
$ git status
On branch master
nothing to commit, working directory clean
**********第九步:合并分支.
测试:在分支上添加一个UserType类.
合并分支之前首先执行第五步和第六步,加载项目文件和提交项目文件.
然后是切换到主分支上,最后合并分支.
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (core_branch)
$ git add .
warning: LF will be replaced by CRLF in git/.mymetadata.
The file will have its original line endings in your working directory.
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (core_branch)
$ git checkout master
Switched to branch ‘master‘
Your branch is up-to-date with ‘origin/master‘.
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (core_branch)
$ git checkout master
Switched to branch ‘master‘
Your branch is up-to-date with ‘origin/master‘.
**********第十一步:删除分支
测试:在分支上添加一个TestDel2类.
假如分支没有合并,你会得到一个错误信息,如下:
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (master)
$ git branch -d core_branch
error: The branch ‘core_branch‘ is not fully merged.
If you are sure you want to delete it, run ‘git branch -D core_branch‘.
You are in ‘detached HEAD‘ state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
问题:如果checkout master时报如下错误,明本地的master和远程的master的head节点已经不在一个commit节点上了,
需要重新push.
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (master)
$ git checkout master
Already on ‘master‘
Your branch is ahead of ‘origin/master‘ by 3 commits.
(use "git push" to publish your local commits)
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (master)
$ git push origin master
Username for ‘https://github.com‘: IluckySi
Password for ‘https://IluckySi@github.com‘:
Counting objects: 59, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (47/47), 3.29 KiB | 0 bytes/s, done.
Total 47 (delta 9), reused 0 (delta 0)
To https://github.com/IluckySi/core.git
c143b5a..99812a9 master -> master
iluckysi@ILUCKYSI-PC /d/ilucky/git/core (master)
$ git checkout master
Already on ‘master‘
Your branch is up-to-date with ‘origin/master‘.