我认为如果你想跟踪文件,你应该git添加[你想跟踪的文件]

我不知道为什么我收到消息说更改没有提交。

如果这些文件不是暂存的,git会显示这些文件是Untracked的

我所做的只是从develop分支中创建一个新特性,并在feature/change_excel_format分支中工作

我以为那些文件应该处于阶段性状态,

但是git状态告诉我没有为提交准备更改

简短的, 我只知道git有3个阶段untracked, staging, committed 谁能告诉我,“改变”的阶段是什么,而不是“提交”的阶段

如果我修改了文件a(已经在repo中)

然后输入git st, git会告诉我Changes not staging for commit

如果我git a,那么文件a将处于阶段性状态

如果我现在修改文件a,文件a在git中会有两种状态,对吧?

所以我必须决定是让有舞台的a被提交还是让没有舞台的a被舞台, 然后之前的暂存文件a将被丢弃?


当前回答

我也收到了这条消息,所以我在python代码中这样做:

text = input("Insert commit: ")
os.system("git add .")
os.system("git commit -m %s" %(text))
os.system("git push origin master")

它成功了,现在没有问题了。 这些命令在带有python3的debian服务器上使用。

其他回答

假设你保存了一个新的文件更改。(例如navbar.component.html)

Run:

ng status
modified:   src/app/components/shared/navbar/navbar.component.html

如果你想要上传这些文件的更改,你必须运行:

git add src/app/components/shared/navbar/navbar.component.html

然后:

git commit src/app/components/shared/navbar/navbar.component.html -m "new navbar changes and fixes"

然后:

git push origin [your branch name, usually "master"]

---------------------------------------------------------------

或者如果你想上传你所有的更改(几个/所有文件):

git commit -a

然后就会出现"请输入更改的提交消息"

如果git commit没有消息(-m),你会看到这条消息 你可以通过两步来摆脱它: 1.。键入多行消息以继续提交。 1. b。保留空白以中止提交。 点击“esc”,然后输入“:wq”,按enter键保存你的选择。中提琴!

然后:

git push

和中提琴!

我也收到了这条消息,所以我在python代码中这样做:

text = input("Insert commit: ")
os.system("git add .")
os.system("git commit -m %s" %(text))
os.system("git push origin master")

它成功了,现在没有问题了。 这些命令在带有python3的debian服务器上使用。

遵循以下步骤:

1- git私藏 2- git添加。 3- git commit -m "你的提交信息"

Git版本2.x。x(当前版本)

“未提交的更改”意味着某些更改未提交。

因此,为了完美地进行所有更改,运行以下命令:

git add -A

然后执行如下命令:

git commit -m "Update"

此外,当得到“Changes not staging for commit”时,就像我上面已经说过的那样,运行这个命令来完美地staging所有更改:

git add -A

如果你运行这些命令,所有的更改都不会完美地上演:

git add .
git add --ignore-removal .
git add -u  

这个表格显示了我在Git Version 2.x中提到的命令的差异。x(当前版本):

Command New Files Modified Files Deleted Files Description
git add -A ✔️ ✔️ ✔️ Stage all (new, modified, deleted) files
git add . ✔️ ✔️ ✔️ Stage all (new, modified, deleted) files in current folder
git add --ignore-removal . ✔️ ✔️ Stage new and modified files only
git add -u ✔️ ✔️ Stage modified and deleted files only

当您向代码中添加了一个新文件,并且现在试图提交代码而不进行分段(添加)时,您可能会看到此错误。

为了克服这个问题,你可以先使用git add (git add your_file_name.py)添加文件,然后提交更改(git commit -m "Rename Files" -m "Sample script To Rename Files as you like")