当前位置: 代码迷 >> 综合 >> git 提交指定的文件
  详细解决方案

git 提交指定的文件

热度:40   发布时间:2024-01-25 02:59:52.0

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.txtUntracked 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.txtUntracked 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 提交指定文件的全部内容。

 

  相关解决方案