Changing GIT submodules URL/Branch to other URL/branch of same repository
GIT documentation and GIT Tools-Submodule discusses about Submodules
operations such as add, status, init/deinit, update, checkout, merge commands
etc. These commands have solid examples on how to work on submodules in a
repository. Good GUI such as GItEx or TortoiseGIT or GitGUI clients for GIT
Bash have these features implemented for submodule.
But, They
lack behind in explaining on how to change a submodule from one URL to another
or to change the path or to change the branch in the same submodule. Some
developers are discarding/not using submodules for the same reason. There are
lot many solutions running around the internet on how to change the submodules.
One of the solution is deleting and adding the submodules on fresh. Else, The other solutions explains by editing .gitmoduels
or config file from .git folder using a text editor and to do a sync
and update.
Here is
an good example on how to change the submodule using the GIT Bash commands
successfully.
The steps
involved are:
1. List the
details in .gitmodules file using GIT Bash command
$ git config --file=.gitmodules -l
This command lists all the submodules present in the current repository with
their paths, URL location and the branch which it is mapped in the repository.
2. Edit the Submodule URL in .gitmodules file using GIT Bash command
$ git config --file=.gitmodules submodule.Submod.url
https://github.com/pavansn/GitSubmodules.git
This command will edit the URL of the submodule and will place it with the specified new URL repository. On using the command from step 1. It displays the changed URL(but the contents of Submodule are not updated)
3. Edit the Submodule Branch in .gitmodules file using GIT Bash command
$ git config --file=.gitmodules submodule.Submod.branch Developer1
This command will edit the Branch (Dev1) of the submodule and will place it in the specifified Branch (Developer1) On using the command from step 1. It displays the changed branch(but the contents of Submodule are not updated)

4. Sync and update the Submodule using GIT Bash commands
$ git submodule sync
$ git submodule update --init --recursive --remote
These commands will sync and update the submodule to the newly specified branch or URL successfully.
------------------------------CMDs to edit and update the submodules----------------------------------
$ git config --file=.gitmodules -l
$ git config --file=.gitmodules submodule.Submod.url https://github.com/username/ABC.git $ git config --file=.gitmodules submodule.Submod.branch Development $ git submodule sync $ git submodule update --init --recursive --remote
------------------------------CMDs to edit and update the submodules----------------------------------
Youre so cool! I dont suppose Ive read something like this before. So nice to seek out somebody with some unique thoughts on this subject. realy thanks for beginning this up. this web site is one thing that is wanted on the internet, someone with slightly originality. useful job for bringing something new to the web! play casino
ReplyDeleteSap fico training institute in Noida
ReplyDeleteSap fico training institute in Noida - Webtrackker Technology is IT Company which is providing the web designing, development, mobile application, and sap installation, digital marketing service in Noida, India and out of India. Webtrackker is also providing the sap fico training in Noida with working trainers.
WEBTRACKKER TECHNOLOGY (P) LTD.
C - 67, sector- 63, Noida, India.
F -1 Sector 3 (Near Sector 16 metro station) Noida, India.
+91 - 8802820025
0120-433-0760
0120-4204716
EMAIL: info@webtrackker.com
Website: www.webtrackker.com
I really enjoyed your blog Thanks for sharing such an informative post.
ReplyDeleteshuttering works
I really enjoyed your blog Thanks for sharing such an informative post.
ReplyDeletebest seo company for increse your website traffic SSS digital Marketing
It's very Amazing to visit this sites...Thanks for all your valuable information's
ReplyDeleteJava training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery
nice article post.keep updating us.We offer the most budget-friendly quotes on all your digital requirements. We are available to our clients when they lookout for any help or to clear queries.
ReplyDeleteBest SEO Services in Chennai | digital marketing agencies in chennai | Best seo company in chennai | digital marketing consultants in chennai | Website designers in chennai
nice article post.keep updating us.We offer the most budget-friendly quotes on all your digital requirements. We are available to our clients when they lookout for any help or to clear queries.
ReplyDeleteBest SEO Services in Chennai | digital marketing agencies in chennai | Best seo company in chennai | digital marketing consultants in chennai | Website designers in chennai
Such a nice article. This is one of the most amazing articles I have read so far. Really it was an awesome article. Looking for real active followers for instagram profile, then i would recommend to Buy instagram followers India
ReplyDeleteWell done dear, i have read your post and getting interesting facts. Its better to buy active and real followers, likes and location based traffic to gain online value so here are best website for Social Media Marketing Company in India
ReplyDeleteIf you want to Buy Real Instagram Followers Paytm than you can visit and talk with support direct. Keep posting more articles.
i dont know what was the reason for changing branch to devloper1
ReplyDeletei am stuck at point where you are playing with branch,
ReplyDeletei get an error:
fatal: Needed a single revision
Unable to find current origin/developer1 revision in submodule path 'Submod'
9and9 provides the best digital marketing services in Hyderabad and offers digital branding services to all our small and medium-size businesses
ReplyDeleteIt was reaaly wonderful reading your article. # BOOST Your GOOGLE RANKING.It’s Your Time To Be On #1st Page
ReplyDeleteOur Motive is not just to create links but to get them indexed as will
Increase Domain Authority (DA).We’re on a mission to increase DA PA of your domain
High Quality Backlink Building Service
1000 Backlink at cheapest
50 High Quality Backlinks for just 50 INR
2000 Backlink at cheapest
5000 Backlink at cheapest
Many thanks for your kind invitation. I’ll join you.
ReplyDeleteWould you like to play cards?
Come to the party with me, please.
See you soon...
เล่นบาคาร่า
คาสิโนออนไลน์
คาสิโน
แจกเครดิตฟรี ฝากถอนง่าย
NDUW is a labor registration portal created by the Labor Department, Government of india. The registration of the unorganized workers (working class) of the state takes place on this portal.
Deleteupbocw registration is provided by the Uttar Pradesh government
شركة شراء اثاث مستعمل بالرياض
ReplyDeleteThis comment has been removed by the author.
ReplyDeletejan adhar card very usefull in rajsthan govt. All Process in Download See Now
ReplyDeleteAll hosting info
ReplyDeleteClick
Click ther and hear
cheap wordpress hosting
Click ther and hear
best vps hosting
Click ther and hear
best vps hosting
Click ther and hear
free wordpress hosting reddit
Click ther and hear
Click
Click:-https://cattlepetsdog.blogspot.com/
ReplyDeleteRead australian cattle dog wesen.
Click:-https://cattlepetsdog.blogspot.com/2022/01/australian-cattle-dog-wesen.html
This comment has been removed by the author.
ReplyDeleteletmethink
ReplyDeleteletmethink
letmethink
letmethink
letmethink
letmethink
Land stock positive agree various. Book perhaps no might model.trending-updates
ReplyDelete