Revert a Git Submodule pointer
I have a git submodule in my main git repo. As I understand it, the main repo stores a SHA value (somewhere...), pointing to the specific commit of the submodule that it is "linked to".
I went in to my submodule and typed
git checkout some_other_branch. I have no idea which commit I came from.
I would like to revert that pointer so that the main repo and the submodule are in sync again.
My first (probably naive) instinct was to say
git reset --hard - that seems to work for everything else. To my surprise, it did not work for this scenario.
So I've figured out that I can type
git diff, note the SHA ID that the submodule pointer used to have, and then head into the submodule and
git checkout [SHA ID]... but surely there must be an easier way?
As I'm still learning about git submodules, please feel free to correct my terminology if there are words for concepts that I don't know.
To get a project started, I had to perform git submodule init followed by git submodule update . But now that the cat's out of the bag, I was wondering if there's something I have to do to pack it bac
I'm working with Three20 as a git submodule on my iPhone app. I have a couple custom modifications I've made to the three20 library and would like to commit them such that my project sees the commits.
How do I remove a Git submodule? By the way, is there a reason I can't simply do git submodule rm whatever ?
I made a lot of unhelpful changes, and would like to revert to the state my repo was in before any of the changes. Is there a git command for doing that? Thanks!
Is it possible that mine .gitattributes file affects submodule? I'm interested in specifying filter and smudge/clean, so it would be applied during checkouts in submodule.
Are the following combinations of commands equivalent? Combo #1: git revert HEAD git revert HEAD Combo #2: git revert HEAD git checkout HEAD^ git commit Related thread: Git cancel a revert
I have some large legacy git repository which I divided into modules. My problem is when I try to apply a patch created when we don't use submodule super-project doesn't have the track of submodule fi
I have a Git submodule that I have successfully cloned in to my main project. However, when I make changes in the submodule and try to push them back to the original submodule repository, Git refuses
I have one repo https://github.com/aikiframework/json and add submodule using git submodule add email@example.com:jcubic/json-rpc.git json-rpc and do commit and push, it appear on github (I can click on
I've used git for quite a bit now but stayed away from submodules since I didn't had a good reason to use them. However, recently I began a project which clearly needs to use this feature of git. Howe
I'm trying to add a submodule https://bitbucket.org/hski/issuestats-public/wiki/Home With the following command git submodule add firstname.lastname@example.org:hski/issuestats-public.git issuestats I'm getting t
When I add some particular folders then git tower creates a submodule for that folders. I don't want to create a submodule. Some pattern I notice is that inside this XYZ folder there is a folder named
I am using GIT submodules. After pulling changes from server, many times my submodule head gets detached from master branch. Why does it happen? I have to always do git branch git checkout master Ho
I have a git project (repo1) including a single submodule (repo2). What I would like to achieve is to tag my project using an older commit of my submodule (like HEAD - 3). I tried with a checkout of t
I have done a git revert by mistake in my project and all files return to old version. How can I rollback (restore) my project back. I have worked for almost weeks without commit anything so now all m
I know this question has been beaten to death. But I still don't have a clear understanding of why my submodule is trying to refer to a commit in my superproject. I have a project which has a number o
user$ sudo git submodule update fatal: reference is not a tree: a094dcfeeb43fcd62a9e466156e05e7581026f33 Unable to checkout 'a094dcfeeb43fcd62a9e466156e05e7581026f33' in submodule path 'client/src/uti
Is there a way to change the submodule path to pull from a different repository during build time?
I have a submodule which I changed some local files. The original repository has been modified and I now wish to do a pull on the submodule, but I get an error saying that I will lose my changes. How
I have a git repo with submodule which belongs to someone else. Now I want to make changes to it like adding and modifying. I think about forking the project, then I will use that as a new submodule
I've found instructions on how to revert a single file in a git repository to an earlier version, but am curious if anyone knows of a way to do this through the git extensions for visual studio? This
When I try to add and commit a git repository into another git repository, git helpfully makes it into a submodule. What if I want to track and commit changes to that nested repository in the outer re
In my web app project I have Google minify set up as a git submodule; the idea is that I can keep the minify library up to date by simply running git submodule update. My problem is I have made local
When I run git submodule update No submodule mapping found in .gitmodules for path 'Classes/lib/AFKissXMLRequestOperation' But I have no submodule Classes/lib/AFKissXMLRequestOperation in current rep
I have a project with a git submodule. It is from an ssh://... URL, and is on commit A. Commit B has been pushed to that URL, and I want the submodule to retreive the commit, and change to it. Now, my
When I run git submodule update --init first time on a projects which have a lot of submodules, this usually take a lot of time, because most of submodules are stored on slow public servers. Is there
I committed and pushed some bad things. How do I force revert my local repo to HEAD~7, and re-commit so that HEAD is now at that version? Git docs confuse me. Thanks!
I am testing the new git submodule add -b feature (after git 1.8.2), which creates sub-module that allegedly tracks a branch rather than a commit. I am using git version 1.8.4.msysgit.0. The branch-tr
How do I move files and folders in my master repo into an existing submodule? Can I preserve history somehow?
I did git submodule add git://github.com/msanders/snipmate.vim.git bundle/snipmate and then I deleted the directory. How do I revert it? How do I revert files within it?
This question already has an answer here: How to revert a folder to a particular commit by creating a patch 1 answer In git, how to I revert everything in a specific directory to how it was at
I've corrupted one file and I'd like to revert it back. My project is using git-svn. So how can I revert this one particular file? Or even better if I could view whole change set of this file. Detaile
I have a git repository which uses a submodule which I'd like to point at an annotated tag, but when I do git submodule update new tags don't get fetched. I can get new tags in the submodule by cd-ing
Is there some easy way to rename a git submodule directory (other than going through the entire motion of deleting it and re-adding it with a new destination name). And while we are at it, why is it
I'm trying to get a build going on TeamCity 6.5.6 with a git repo with one submodule but getting failed to start build. .gitmodules file: [submodule src/shared-contracts] path = src/shared-contrac
I have an old submodule branch. I did not make a corresponding topic branch for the main module since my changes only modify the submodule. I have since updated my main module as I and others have bee
I am trying to add a git submodule. The submodule itself works without any problem but my question is about the created layout when adding the submodule. I am adding a simple submodule called utils th
Let's say I have two git repos. RepoA is a common repo that should be shared among other projects. ReopB is some project that needs to access something in RepoA. RepoA https://.../RepoA /Something /So
When cloning submodules from a gitosis repo, I got all files except for the .git directory. .git directory is missing. Instead, I got a single .git file. I use git submodule init and git submodule upd
NOTE: I believe the use-case in this question is significantly different from the ones in How to reverse apply a stash? and Aborting git stash apply. I just did a git stash apply that, to my surprise,
I use git with submodules, and I've hard time to figure out how to organize my files. I develop in PHP, and use unit testing. So right now, I use this organization for each module: src/ tests/ That
I've create a submodule in my repository root in a specific folder. I can see the submodule is well registered in .git/.gitmodules and in .gitmodules, but I can't get it working. I can't see it if I m
I used git filter-branch and screwed something up and accidentally rewrote sections of the history I didn't want to. I was trying to change one name and accidentally changed every single commit (inste
OK, so I'm getting an error sometimes when I try to revert a commit (with Git). All that I do is git revert <commit hash> and it gives me this message: error: could not revert <commit hash>
I have made some changes to a file which has been committed a few times as part of a group of files, but now want to reset/revert the changes on it back to a previous version. I have done a git log a
I added a GitHub-based library as a submodule and modified it. I need to share the modification with my teammates. I won't be able to push it to submodule's GitHub origin, would I? How do I share th
Let's keep things simple shall we? I have a git project set up. Let's call it ProjectA. My friend has another, older git project set up, called ProjectB. In ProjectB, he has two submodules, SubOne and
Git isn't correctly ignoring a bin folder of one of my submodules. Any ideas why? Here is git status in the submodule: MBPR:$ git status # On branch master # Untracked files: # (use git add <file
I'm using the git superproject pattern in a large project which is deployed by a Teamcity build agent which does not have a repository account, however the repository is set up to allow anonymous clon
I'm running into the problem described in this mailing list post. 'git subtree split' fails to reconstruct the history when a revert commit is followed by a merge commit. I have slightly adjusted the