我认为如果你想跟踪文件,你应该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将被丢弃?


当前回答

假设你保存了一个新的文件更改。(例如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

和中提琴!

其他回答

我犯了一个愚蠢的错误。我试图在一个git没有初始化的文件夹中运行这个命令。确保你有。git文件夹或运行命令

git init

假设你保存了一个新的文件更改。(例如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

和中提琴!

遵循以下步骤:

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

这是Git告诉你的另一种方式:

嘿,我看到你对你的文件做了一些修改,但记住当你在我的历史记录中写入页面时,这些更改不会出现在这些页面中。

如果您没有显式地添加git,则不会对文件进行更改(这是有意义的)。

所以当你git提交时,这些更改不会被添加,因为它们不是阶段性的。如果你想提交它们,你必须先执行它们。git添加)。

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

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

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