1

I have a branch named gh-pages which contains index.html because it actually from main branch inside a folder named public. I'm using nodejs for tailwindcss, my directories in main so when I'm pushing that certain folder only, I will use the command

git subtree push --prefix public origin gh-pages

which I got from here which normally works. but then today I added a new folder inside it called tictactoe which only got HTML and JS file and using ../style.css from previous directory then I got this error which says updates were rejected because a pushed branch tip is behind its remote counterpart. check out this branch and integrate the remote changes (e.g. 'git pull ...') before pushing again..

I tried various solution from this site such as

git push -f origin gh-pages

from here but it says Everything up-to-date then I tried pull using git pull -f origin gh-pages but it says fatal: refusing to merge unrelated histories so I tried git pull origin gh-pages --allow-unrelated-histories from here which happens it actually pull but I still can't push the subtree normally and receives the same error as this title.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
qud
  • 11
  • 2

1 Answers1

0

Could you just try the git pull command and then follow all the commit commands. I will give you step-by-step commands so you got a clear idea of how you can do this.

git status

git add "file name"

git commit -m "msg here"

git pull

git push origin your_brnach