This image is my git project:

This image is my git project.

I have two projects, Android and IOS in my git repo. However I don't need IOS project any longer.

So I want my android project to be root directory of git with previous commit logs to a new repository.

I tried to copy android project folder to a new directory and copy .git folder of previous project to it but after pushing it to a new repository, it doesn't work. The IOS folder still posted.

Are there any other ways that you know? What should I do?

Please give me a help.

  • Do you want old commits to preserve the Android logs until today, or do you want to create a modified repository that only has iOS logs? – user1686 Oct 16 '19 at 4:46
  • @grawity I want to create a modified repository that only has Android logs. – gogooma100g Oct 16 '19 at 6:00
Using image is not encouraged in the community because it couldn't be searched and viewed easily, try to do this
├── project/
│   ├── .git
│   ├── android 
│   ├── ios
1. git doesn't track anything outside the root directly, simplified our structure to this first
├── .git
├── android 
├── ios
2. Don't move any .git directory yourself. It is meaningless. It contains all of the previous ios directory information.


Choice a (use the original repo, remove the ios directory, update the directory )

3. Let's assume you delete the ios folder or move it to somewhere else

├── .git
├── android 

4. the ios directory is still tracked in the remote, to stage the change,

git add . 
git commit -m "removed the whole ios folder"
git push 


Choice b, use another repo, keep the ios directory in the original position, move your android directory to somewhere else ( not recommended, your history of commit of android all gone)

in the directory containing the android directory,

git init 

git add .

git commit -m "first commit"

git remote add origin <your url of repo>
git push -u origin master

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.