git提交指定文件
在目录下新建 1.txt 2.txt
分别在两个文件中写入test1 test2内容
在git命令行下输入
git add 1.txt
git status 查看 显示如下内容
$ git status On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: 1.txt Untracked files: (use "git add <file>..." to include in what will be committed) 2.txt
git commit -m 'add 1.txt'
git push或者 git push origin master
添加某个文件夹下的指定文件
继续在此目录下 添加test文件夹,新建文件 3.txt
在 3.txt中写入 test3
git add other/3.txt
git status 查看
$ git status On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: test/3.txt Untracked files: (use "git add <file>..." to include in what will be committed) 2.txt
git commit -m 'add test/3.txt'
git push 或者 git push origin master
以上就是git 提交指定文件的全部内容。