我在 Git 上有一个 Django 项目
我对 Git 不太满意
我已经完成,提交并推送我的 feature/22 分支
我已经提交(在 git add 之后。)并推送我的主人
所以我的两个分支都是最新的
现在,我想在本地将我的 master 与我的 feature/22 合并,但我有冲突
即使在提交后,我在“取消合并路径”中有 2 个文件:
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: unblind/migrations/__pycache__/0002_auto_20200124_0904.cpython-37.pyc
both modified: unblind/migrations/__pycache__/0003_auto_20200124_1007.cpython-37.pyc
Run Code Online (Sandbox Code Playgroud)
如果我使用推荐的命令 git add 会怎样?
为什么这两个文件没有包含在之前的 git add 中。命令?
编辑:
$ git merge feature/22
warning: Cannot merge binary files: unblind/migrations/__pycache__/0003_auto_20200124_1007.cpython-37.pyc (HEAD vs. feature/22)
warning: Cannot merge binary files: unblind/migrations/__pycache__/0002_auto_20200124_0904.cpython-37.pyc (HEAD vs. feature/22)
Auto-merging unblind/migrations/__pycache__/0003_auto_20200124_1007.cpython-37.pyc
CONFLICT (content): Merge conflict in unblind/migrations/__pycache__/0003_auto_20200124_1007.cpython-37.pyc
Auto-merging unblind/migrations/__pycache__/0002_auto_20200124_0904.cpython-37.pyc
CONFLICT (content): Merge conflict in unblind/migrations/__pycache__/0002_auto_20200124_0904.cpython-37.pyc
Removing randomization/templates/randomization/_randomisation_edit.html
Automatic merge failed; fix conflicts and then commit the result.
Run Code Online (Sandbox Code Playgroud)
编辑2:
我暂时解决了我的合并问题:
但是 .pyc 仍然被跟踪,并且在 master 上运行我的 django 项目后,如果我执行 git status:
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: export/migrations/__pycache__/__init__.cpython-37.pyc
modified: parameters/migrations/__pycache__/0003_auto_20200128_1337.cpython-37.pyc
modified: parameters/migrations/__pycache__/0004_auto_20200129_1206.cpython-37.pyc
modified: parameters/migrations/__pycache__/0005_auto_20200305_0810.cpython-37.pyc
modified: parameters/migrations/__pycache__/0006_auto_20200305_1238.cpython-37.pyc
modified: parameters/migrations/__pycache__/0007_auto_20200305_1242.cpython-37.pyc
modified: parameters/migrations/__pycache__/0008_auto_20200305_1428.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0001_initial.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0002_auto_20200129_1206.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0003_auto_20200129_1434.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0004_auto_20200210_1750.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0005_historicalstock_stock.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0006_auto_20200218_1344.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0007_auto_20200218_1359.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0008_auto_20200218_1403.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0009_auto_20200218_1410.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/0010_auto_20200302_1059.cpython-37.pyc
modified: pharmacy/migrations/__pycache__/__init__.cpython-37.pyc
modified: randomization/migrations/__pycache__/0008_auto_20200302_1059.cpython-37.pyc
Untracked files:
(use "git add <file>..." to include in what will be committed)
unblind/migrations/__pycache__/
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
您可以忽略/__pycache__/项目中的任何文件夹。
.gitignore,您可以在项目文件夹中创建一个:project/.gitignore.*/__pycache__/*在.gitignore