git 我无法提交(你的分支是最新的,带有“origin/master”)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39605021/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:17:53  来源:igfitidea点击:

I can't commit (your branch is up-to-date with 'origin/master')

gitgitlab

提问by Amine Harbaoui

I created a project on gitlab and I added a user as developer, so my colleague clone the project correctly and he created a new file but when he try to commit with the following command :

我在 gitlab 上创建了一个项目,并添加了一个用户作为开发人员,因此我的同事正确克隆了该项目并创建了一个新文件,但是当他尝试使用以下命令提交时:

git commit -a -m "update" 

he got this message :

他收到了这条消息:

enter image description here

在此处输入图片说明

any explanation and help ?

任何解释和帮助?

回答by Faisal Arkan

after you do

在你做完之后

  • git init
  • git init

if you want submit all of you file code just type

如果您想提交所有文件代码,只需键入

  • git add .
  • git add .

after that you can do

之后你可以做

  • git commit -m "First commit"
  • git commit -m "First commit"

next ->

下一个->

  • git remote add origin remote repository URL

  • git remote 添加源远程存储库 URL

in the end,

到底,

  • git push origin master
  • git push origin master

hope it's help.

希望有帮助。

more useful reference -> github docs existing project

更有用的参考 -> github docs 现有项目

回答by Rishi B

You have a new file in your project. For any new file, you need to add it by running git add .and then run your commit message. git commit -adoesn't let you commit any new files that you haven't told git to track yet.

您的项目中有一个新文件。对于任何新文件,您需要通过运行添加它git add .,然后运行您的提交消息。git commit -a不允许你提交任何你还没有告诉 git 跟踪的新文件。