简体   繁体   中英

GIT: merging files after working in wrong directories

I have a problem, I was working with a friend the first time on a Wordpress Theme and Git. It wasn't my first time using git and I assumed we have both installed and setup everything correctly.

However the problem is the following.

I have git installed in the /wp-contents/themes directory. My friend has git installed inside /wp-contents/themes/theme-name .

I worked on some files today, and so did he. However after a while of work and committing and pushing I finally see, that in our Repo there is now a directory /wp-contents/themes/theme-name/themen-name that I pushed and worked on somehow.

And the files he pushed are outside of the /theme-name folder for me. So on my local machine I see this now:

在此处输入图片说明

Meaning the files of my friend are visible for me outside of the actual theme.

However I worked inside the theme file on some files that should have been merged.


Long story short: How do I fix this and merge the files. What do I have todo to have the same working environment on both machines of me and my friend. Is there a way to merge those files and just have one theme-folder (without a copy inside it) and both working in the same folder.

Thanks for the help.

Agree on which level you have the git repository, then one of you moves the files from one location to the other, reviews the changes with git diff and combines them properly, then go on from there. The one who has to switch his location of repository should then just re-clone the repo in the correct place.

git fetch /wp-contents/themes master
git merge -s ours --no-commit FETCH_HEAD
git read-tree --prefix=wp-contents/themes -u FETCH_HEAD
git commit -m "message"

Actually i propose to merge directories manually and commit the changes.

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