Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git locally, push to tfs remote repo

I'm so tired of explaining benefits of using DVCS over CVCS to my teammates. Some of them scared of the learning curve, some of them see no reasons because for them: "tis the same fokin ting". Personally I'm so tired of TFS and its problems. Everytime when I need to work on some small "fix" I have to work on the main dev branch and shelve my stuff in and out, cause branching with TFS so darn painful compared to Git. I have to reconnect my VPN client every single time I switch from ethernet to wifi and that happens a lot.

So I started thinking maybe I could use Git locally and do whatever I want on my local repo, and when the time comes push it to TFS. I know it's possible, but what's the best way to do that? Can I just git init the current repo and put the entire .git folder into ignored list, so TFS wouldn't check it in or doing just that isn't simply enough?

Until the official update of Visual Studio comes, that will support both git and tfs, I have to use some hacks to do what I want.

like image 246
iLemming Avatar asked Mar 06 '13 16:03

iLemming


People also ask

How do I push from local to remote repository?

Push a new Git branch to a remote repo Clone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch.

How do I push a local branch to remote in Visual Studio?

To push a local branch to the remote, right click on that branch in Team Explorer. From the context menu, that pops up on the screen, select Push Branch.


2 Answers

git-tfs https://github.com/git-tfs/git-tfs worked for me better. Easy to install. Easy to use. A bit slow though, but if you don't mind that - works just perfect

like image 65
iLemming Avatar answered Sep 17 '22 18:09

iLemming


Yes, you are exactly correct - you just need to deal with .git in TFS. In general, everything GIT does is maintained in .git so if you have a way to keep it out of TFS (worst case is move out and then move back) then you can use GIT without problems.

Note that there may be other GIT related files to deal with, .gitignore being the most common example.

I've successfully overlaid GIT and SVN using awareness of .git and related files. (I know there is a git-svn package; but that wasn't workable for my specific need.)

Also, look into:

  git init --separate-git-dir=<other-location-for-dot-git>

You'll still need to deal with a symbolic link in the local directory but perhaps TFS issues are easier to deal with.

like image 21
GoZoner Avatar answered Sep 17 '22 18:09

GoZoner