git - git只推送2个文件
问题描述
我只更改了 2 个文件,它们是我唯一想推送到 Github 的文件。我已经添加了我想要的 2 个文件并提交了带有注释的更改。但是,当我推动时,我得到以下信息:
git push
To github.com:TinsleyBridgeGroup/TBL-bending-presses.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:TinsleyBridgeGroup/TBL-bending-presses.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
基于上述我 git 拉并收到以下错误:
git pull
error: Your local changes to the following files would be overwritten by merge:
TBL165-238.json
TBL165-279.json
Please commit your changes or stash them before you merge.
Aborting
如何推送我已更改“read_pressure.py”和“TBL165-238.json”的 2 个文件。一点背景知识,该脚本用于多个 IOT 设备。json 文件是特定于机器的设置,而 read_pressures.py 是通用的并在多台计算机上运行。下面列出了 Git 状态命令。
git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 3 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
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: .vscode/launch.json
modified: .vscode/settings.json
modified: TBL165-238.json
modified: TBL165-279.json
modified: read_pressure.py
no changes added to commit (use "git add" and/or "git commit -a")
解决方案
请尝试以下步骤。
- 混帐藏匿
- git 拉
- git stash apply(如果有冲突,解决冲突)
- 混帐添加。
- git commit -m '消息'
- git 推送
推荐阅读
- javascript - 如何允许我的用户使用手机号码或电子邮件地址在 Cognito 用户池上重置密码?
- python - 即使将文件夹路径添加到 PATH env var,cmd 也找不到 python.exe 文件
- spring-boot - Spring数据Cassandra如何在保存时处理null
- amazon-web-services - AWS PinPoint - 来自邮递员的短信
- web - 从搅拌机导出的 USDZ 模型损坏
- c++ - 试图编译一个 cpp 文件,但命令提示符说找不到文件
- python - Dash 回调“解析时出现意外的 EOF”错误
- python - 如何在python3中拆分一个单词字符串?
- bash - 即使我添加了 --jobs 并且 --max-load 甚至没有关闭,为什么 GNU Make 会按顺序运行?
- javascript - “input=text”字段中的引导过滤值