git只提交修改部分的代码

半腔热情 提交于 2019-12-02 18:19:52

思路:

先用git status 查找出哪些文件被修改过了,然后 只git commit odin/code/pom.xml 


 

1、

$ git status (查看当前更改的代码)

On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   odin/code/pom.xml

 

faith@faith_java-PC MINGW64 /d/aa/testcommit/vvv/odin (master)

2.

$ git pull (拉取最新代码)

Already up to date.

faith@faith_java-PC MINGW64 /d/aa/testcommit/vvv/odin (master)

 

3.

$ git commit   odin/code/pom.xml   -m   "test commit" (提交部分代码加备注)

[master f0e1185] test commit
 1 file changed, 1 insertion(+), 1 deletion(-)


faith@faith_java-PC MINGW64 /d/aa/testcommit/vvv/odin (master)

 

4.

$ git push origin master (推送到远程服务器)

Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 439 bytes | 439.00 KiB/s, done.
Total 5 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To github.com:zhangjq520/zjq_gitlib_code
   2bd7ce0..f0e1185  master -> master

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!