![]() If you want to see what this looks like once pushed to remote (github. Git commit -amend -no-edit # I combined this with the previous commit where I added the 'branch' value in. So finally, I did what I was trying to avoid: git add You have to go and update that submodule commit reference to the latest code in the remote branch to avoid this ![]() So far, I was following the official git reference for submodules, now I decided to do some more Googling, and I stumbled an article titled Getting git submodule to track a branch, this clearly said Post this, when I ran git submodule update -remote -init -recursive, it would no longer revert my submodule's HEAD in detached state to commit A however it still kept showing the annoying modified: (new commits) So then I set the branch value as new-submodule-branch in /.gitmodules as follows If, from the main repo root, I ran git submodule update -remote -init -recursive, it kept reverting my submodule's HEAD in detached state to commit A In the diff pane you used to be able to select multiple lines, right-click and select 'Stage selected lines' or. ![]() After upgrading to 2.6.10 on Windows 10 I can't seem to find this functionality anymore. " to discard changes in working directory) One of the main reasons I use SourceTree is the ability to commit changes to individual lines of a file, or discard those individual changes. Post this, my main repo started showing Changes not staged for commit: Initially my submodule was at commit A (at the time of adding submodule to main repo), then I checked out a branch (let us call it new-submodule-branch) and made commits B and C to it and pushed it to remote () I am documenting/sharing here what worked for me. None of the answers here solve my problem. To update which commit records should be checked out for the submodule, you need to git commit the submodule in addition to committing the changes in the submodule: git add src/repo No changes added to commit (use "git add" and/or "git commit -a") (commit or discard the untracked or modified content in submodules) " to discard changes in working directory) git status also claims submodule has untracked/modified content. Otherwise it shows -dirty hash change which you cannot stage or commit in the top-level repository. If you've already made some commits in your submodule (thus "clean" in submodule), it reports submodule's hash change. Run git diff in the top-level repository to show what has actually changed Git thinks. If you change something in submodule dir, Git will detect it and urge you to commit those changes in the top-level repoisitory. It's because Git records which commit (not a branch or a tag, exactly one commit represented in SHA-1 hash) should be checked out for each submodule. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |