Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Having a pull request conflict issue

I am trying to merge a branch with the master branch but my conflict is hard to resolve as it says use cmd line and with the cmd line options give it doesnt resolve the issue.

Github is giving me this...

Step 1: From your project repository, bring in the changes and test.

git fetch origin
git checkout -b static origin/static
git merge master

Step 2: Merge the changes and update on GitHub.

git checkout master
git merge --no-ff static
git push origin master

Then when i try it i get this output

(venv) C:\Users\jferguson\PycharmProjects\WebP1\DEMOPROJECT>git fetch origin

(venv) C:\Users\jferguson\PycharmProjects\WebP1\DEMOPROJECT>git checkout -b static origin/static
fatal: A branch named 'static' already exists.

(venv) C:\Users\jferguson\PycharmProjects\WebP1\DEMOPROJECT>git merge master
Already up to date.

(venv) C:\Users\jferguson\PycharmProjects\WebP1\DEMOPROJECT>git checkout master
Switched to branch 'master'
Your branch and 'origin/master' have diverged,
and have 2 and 2 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

(venv) C:\Users\jferguson\PycharmProjects\WebP1\DEMOPROJECT>git merge --no-ff static
Already up to date.

(venv) C:\Users\jferguson\PycharmProjects\WebP1\DEMOPROJECT>git push origin master
To fortress-sefa.git
 ! [rejected]        master -> master (non-fast-forward)

The conflicting files are

DEMOPROJECT/__pycache__/__init__.cpython-37.pyc
DEMOPROJECT/__pycache__/settings.cpython-37.pyc
DEMOPROJECT/__pycache__/urls.cpython-37.pyc
DEMOPROJECT/__pycache__/wsgi.cpython-37.pyc

Is there a significance in the fact it is cache files?

like image 678
Joelad Avatar asked Apr 19 '26 13:04

Joelad


1 Answers

These are *.pyc files, and the Python glossary specifies:

Python source code is compiled into bytecode, the internal representation of a Python program in the CPython interpreter. The bytecode is also cached in .pyc files so that executing the same file is faster the second time (recompilation from source to bytecode can be avoided).

It is thus a by-product of the Python interpreter running your program. Usually there is no added value in storing these. In fact if the timestamp is somehow newer than the file itself, it is possible that the interpreter will use the compiled version of a module that you changed, so it is a bit "risky" to keep these in the repository.

Furthermore it will make the repository larger, since each time you change the source code of a file, and you run the interpreter, the corresponding .pyc will change, and thus this will create a huge amount of changes that will be stored in the repository as well. Although git is not particularly bad with binary files, binary files that are updated frequently have a cost in terms of diskspace.

It is better to add *.pyc to your .gitignore, and remove the files with git rm '*.pyc' to remove the files from your git repository.

Python projects usually have a lot of extra files that your probably want to ignore, for example files in the virtual environment. There is a GitHub repository that has .gitignore [GitHub] files for programming languages. Perhaps you want to include these in your own .gitignore.

like image 135
Willem Van Onsem Avatar answered Apr 21 '26 01:04

Willem Van Onsem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!