track git remote branch (note to self)
git config branch.master.remote origin git config branch.master.merge refs/heads/master
git config branch.master.remote origin git config branch.master.merge refs/heads/master
I’ve been a looong time eclipse user and have tried intellij off and on over that time. I never really got hooked on intellij like some people I know…until recently. I’m not sure why it stuck with me this time, but this post will serve as my list that I can point people to when I get asked “the question”
IntelliJ - The Good
Not too much for now, but I’ll add to it as thing come to me.
So you installed projectplus or the git bundle for textmate and it doesn’t work? Try setting a TM_GIT shell variable (located in the advanced properties) to /usr/local/git/bin/git.
For all the benefits git has over svn, I found one thing that I was missing…svn:externals. There are a few suggesstions that you come across when searching around on this topic, one being git subprojects and another being git submodules.
I couldn’t find (read lost desire) a whole lot on subprojects, but from what I got out of it is you just do a git clone of your external project in whatever directory of your project. I tried that, committed, and pushed, but when I cloned it back just the directory was there…no files. Granted, I didn’t spend a lot of time on this, but if it were as easy as clone, commit, push then I guess everyone would be using it.
Git submodules are a little more involved and require extra commands after a clone…git submodule update. Also, these modules are bound to a specific commit where I wanted the latest (like how svn:externals work). Too much work.
So it appears, unless I’m missing something, that git doesn’t have a 100% replacement for svn:externals.
In my case I don’t care about the history of the external repo being in my repo, I just want the latest in there. Also, the external repo I need is relatively small so duplication between repos is not an issue. Finally, I don’t need to change or push to the external repo from the local one.
So I ended up with a sync job that runs every hour that looks like this…
#!sh
function sync_project() {
rm -rf $1
git clone ssh://git-server/$1.git
cd $1
rm -rf local/path/external-project
mkdir -p local/path
cp -R ../external-project local/path
rm -rf `/bin/find . -type d -name .svn`
git add .
git add -u
git commit -m "auto sync"
git push origin master
cd ..
}
rm -rf external-project
svn co http://svn/external-project
sync_project "my-project"
sync_project "my-other-project"
You’ll notice that my external project comes from svn, this can easily be replaced with whatever scm it’s in.
Suppose for whatever reason you need to pull in changes from a remote repository and you have uncommitted files that you don’t want to commit. Git won’t let you do that if it needs to merge changes to one of your uncommitted files. Try this…
git stash
git pull
git stash pop