git只提交修改部分的代码

思路:

先用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

原文地址:https://www.cnblogs.com/mmzuo-798/p/11757337.html