简体   繁体   English

在 git 中未跟踪的新目录中单独提交特定文件

[英]Commit separately specific files inside untracked new directory in git

I have a new created directory "supplier_directory", in which there are 3 new files.我有一个新创建的目录“supplier_directory”,其中有 3 个新文件。 I need to add these files into different commits.我需要将这些文件添加到不同的提交中。

  1. Commit N1: file1 only提交 N1:仅文件 1
  2. Commit N2: file2 and file3提交 N2:file2 和 file3

I'm having the following:我有以下情况:

supplier_directory

when trying:尝试时:

git status

I'm enable to add or show changes of certain files inside this untracked and new directory evenly when running 'git status' inside it.当在其中运行“git status”时,我可以在这个未跟踪的新目录中均匀地添加或显示某些文件的更改。

Stage/add the files one by one or in groups, committing after each change.逐个或成组地暂存/添加文件,在每次更改后提交。

git add file1
git commit -m "adds file 1"
git add file2 file3
git commit -m "adds file 2 and 3"

...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM