Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

I am not able to switch from my local branch to master branch after linking a sub module.

I wanted to replace folder in my repository with a remote sub module. For this purpose I initially deleted the folder content then committed those changes to a newly created local branch.

Then I linked with a sub module which is pointing a specific commit. After that I committed the sub module linking changes to my branch. Now I am trying to switch from current branch to another branch but it is giving me error. The error messages shows 

error: The following untracked working tree files would be overwritten by checkout:

  "listed the deleted files in initial step"

Please move or remove them before you switch branches.Aborting

2 answers

1 accepted

1 vote
Answer accepted

You need to check the status of your working directory like this `git status`. Based on that, ensure if all your work is committed or not. If done, then decide if the untracked files are what you need in future. If yes, then keep a safe copy or else you can use `git clean` or `git clean -f`  (forced clean) for this. Using `git checkout -f  <branch>` is another option. This problem happens as git is keeping a track of those deleted files. Since you have a version control, so restoration is also possible in case things go unintened.

 

Assumptions: The linking action successfully replaced the folder.

Thanks for your support.

Git status shows nothing to commit. Then I tried the git clean option but still the error is there.

And the checkout option shows like below is this expected behavior.

$ git checkout -f feature/submodule_svdioh
warning: unable to rmdir 'folder which is to be replaced with sub module': Directory not empty
Switched to branch 'feature/submodule_svdioh'

git clean -d -f

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events