- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试将我的更新文件推送到 github 上的远程存储库,使用 git 版本 1.8.4.2 运行 OSX Snow Leopard。
我已经成功地完成了 git init
然后是 git add .
和 git remote add origin https://github.com/me/repo.git
。然后我做了一个 git commit -m "first commit"
然后是 git push origin master
所有这些都很好用
问题是当我尝试再次提交和推送时,我收到一条消息返回给我。例如,我更新了一些文件,提交了一条消息,然后运行了 git push remote origin
。
除了显示“Everything up-to-date”之外,该命令有效。我扫描了大约六个具有类似错误的堆栈溢出问题,其中很多与不在正确的分支上或处于分离头模式有关。我相信我的情况两者都不是。
这是 git log --graph --all --decorate --pretty=oneline
的结果:
* 6926001f0eed54c05f807eb04ed05fd0584cd2e6 (HEAD, origin/master, master) first commit
这里是 git remote show origin
* remote origin
Fetch URL: https://github.com/me/repo.git
Push URL: https://github.com/me/repo.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (up to date)
这里是 git branch -v
* master 6926001 first commit
我不确定我还能提供哪些其他信息,但请告诉我,我会更新问题。我是 git 的新手,感谢阅读!
编辑:
我再次运行第二次提交并收到此消息:
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: file1
# modified: file2
# modified: file3
#
no changes added to commit (use "git add" and/or "git commit -a")
最佳答案
在 git commit
实际进行新提交之前,您需要将文件添加到“暂存区”。1
“暂存区”让您可以按照自己的方式安排所有内容,这有时与您在工作目录中需要的设置不同(例如,您可能需要调整配置文件以测试新功能的第 1 部分,但还不想提交特定的配置文件更改)。
通常明智的做法是在 git commit
之前运行 git status
以查看哪些内容已准备好提交,哪些内容尚未暂存。此外,git diff --cached
显示将提交的内容(比较 HEAD
提交到暂存区),而 git diff
没有 --cached
显示不会提交的内容,即尚未上演的内容。
作为快捷方式,您可以使用 git commit -a
,它会自动添加显示为 modified
或 deleted
的文件git status
输出。 (但这不会添加“未跟踪”文件。再次查看 git status
的输出。)
为了完整起见,我将添加 git diff HEAD
显示如果您运行 git commit -a
您将提交的内容。 (这三个 git diff
变体在 git diff
documentation 中的示例部分下列出。)
这里有一些关于暂存区的网络引用:
http://gitready.com/beginner/2009/01/18/the-staging-area.html
http://git-scm.com/book/en/Getting-Started-Git-Basics (这是一本 Pro Git 书,非常好,但也可能会让人很困惑,主要是因为 git 本身也很让人困惑)。
1技术上不太正确:更准确地说,就在提交之前,git commit
快速比较要提交的内容与当前的 HEAD
提交。如果没有区别,它将停止,除非您指定了 --allow-empty
。使用-a
,“要提交的内容”包括修改和删除的文件;仅当没有时,您仍然需要 --allow-empty
来进行新的提交。
关于Git 推送返回 "Everything up-to-date",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23921293/
数据框有一个字符串类型的日期列 '2017-01-01' 它被转换为 DateType() df = df.withColumn('date', col('date_string').cast(Dat
这个问题在这里已经有了答案: What is "x && foo()"? (5 个答案) 关闭 8 年前。 我在 bootstrap-datepicker.js 文件中遇到过这个。 作者在_setD
我有一个数据库 utc 字符串,我正在传递到 Date(attrs.endDate),然后通过 new Date() 减去当前的 utc 日期,但我无法得到它来为我提供 2 个 utc 日期的正确差异
这个问题在这里已经有了答案: how to determine if 2 dates object equals each other? [duplicate] (3 个答案) 关闭 6 年前。 我
这个问题已经有答案了: How can I convert "/Date(1399739515000)/" into date format in JavaScript? (3 个回答) 已关闭 8
根据MDN ,我们只能将以下类型的参数传递给 Date 构造函数: new Date(); new Date(value); // Unix timestamp new Date(dateString
我从表中获取所有项目: endDate >= 现在 endDate 为 NULL published 等于 1。 这是我所拥有的,但它给了我 0 个项目: $items = Items::orderB
此查询需要很长时间才能完成。当我将 WHERE 子句设置为 new_dl >= '2014-01-01' 时,查询大约需要 6 分钟才能浏览大约 3 个月的数据。现在不知道为什么这个应该从 12 个月
我有一个正在为项目开发的小型 Java 程序,它使用 JavaMail 从指定的 URI 中提取用户的收件箱,然后开始处理消息。 在 Outlook 中,属性菜单中有一个功能可以设置邮件的到期日期,它
我想在获取 Date.getHours()、Date.getMinutes() 和 Date.getSeconds() 的值后格式化输出>. 这是一条漫长的路: var dt = new Date()
我发现java.text.DateFormat有两种格式化日期的方法。一种是采用 Date 参数,另一种是采用 Object 参数。我检查了DateFormat源代码,似乎他们调用了不同的内部方法。
我有两个对象,p4 和 p5,它们都具有 Date 属性。在某些时候,构造函数工作正常: p4.setClickDate(new Date(System.currentTimeMillis() - 8
我是使用 Sequelize 和 Node.js 的新手,但我的代码中存在日期比较问题。 User.findOne({ where: { resetToken: passwordToken,
我正在使用一个名为 fullcalendar 的 jquery 日历。当用户单击某一天时,他们将被发送到另一个页面以创建该天的事件。单击的日期作为 date 提供。然后通过下面的函数运行将其转换为 U
我有一个列表列表,每个列表中都有整数值,代表 8 年期间的日期。 dates = [[2014, 11, 14], [2014, 11, 13], ....., [2013, 12, 01]
我有两个表: 首先是TimeValues(示例) time | value 12/28/18 | 5.6 01/03/19 | 5.6 01/04/19 | 5.6 01/09/19 | 5.
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
像这样实例化的日期对象: new Date("2011-12-13") 返回一个认为自己是星期一的日期对象: Date {Mon Dec 12 2011 16:00:00 GMT-0800 (PST)
我需要选择入住日期和退房日期在指定日期范围之间的房价。这些费率根据其条件单独命名。房费取决于所选日期。这是我的代码: rate_eb rate_name rate_starts rat
我有 [Int64:[String:String]] 其中 Int64 是时间戳。如何检测和删除 [String:String] 中的参数之一是 ["name"] = "test" 并重复多次的同一天
我是一名优秀的程序员,十分优秀!