简体   繁体   中英

git bash branches conflict

I am new to git bash. I used to upload my projects on my github page online only using the website.

I need to use git bash in order to be able to upload bigger files. I uploaded successfully some files, and I am not sure if I was supposed to "close" somehow the branch or delete it.

With my limited knowledge, I reopened git in order to add some more files later, and used the command git init yet again, but now I can't push my files.

I think it created multiple branches. When I try to push, I get:

"Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. git pull) before pushing again." 

When I try git pull I have the following error:

"fatal: refusing to merge unrelated history", 

or

git pull origin master --allow-unrelated-histories 

I get:

"Encountered 1 files that should have been pointers. but weren't. Automatic merge failed. Fix conflicts and then commit the result."

I think I also added a file that I did not commit in previously. I figured this one file uses LFS (large file storage), because as I said I want to upload large files. By using git lfs track "*.file-type" it is tracking the file using a pointer.

When I retry here is the output

"your branch and 'origin/master' have diverged"

What am I missing? what should I do?

Solved, When it says that a file is not a pointer but should, it means that lfs tracking is enabled for this type of files. but this one file is not being tracked properly, Could be that lfs tracking for this type of files was enabled after adding this file. but the file wasn't commited. In this case you need to manually track it with git lfs track name-of-file.extension-of-file . After this, if it doesn't let you merge, you need to add all files from both branches in conflict that are missing or were modified. git add. adds the missing files for you, but you must have them in your directory too. Then git commit -m "removed conflict" and git push . That is all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM