Search This Blog

Showing posts with label Git. Show all posts
Showing posts with label Git. Show all posts

2012-03-26

My git ignore for ASP.NET

For those how use git Source Code Management for .NET/ASP.NET solutions there is a start-up routine to add irrelevant files and folders to ignore list. Just to make life easier I tried to create my own list based on common needs. 
First, we usually don't need bin and obj folder since we are interested in sources only; Visual Studio and Resharper files: *.suo, *.user, *cache, _ReSharper*. If you use NuGet and NuGet Package Restore you are probably not interested in packages folder.
Another very controversial issue is to ignore upgrade and backup files after solution migration, but usually I don't need them as well :-): UpgradeLog.XML, _UpgradeReport_Files, Backup.
Great TDD tools like NCrunch and NSubstitute could help you a lot, but  *.ncrunchproject, *.ncrunchsolution, *NSubstitute* files might be ignored.
Finally, my .gitignore:
bin/
obj/
packages/
*.suo
*.user
*cache
_ReSharper*

*NSubstitute*

*.ncrunchproject
*.ncrunchsolution

UpgradeLog.XML
_UpgradeReport_Files
Backup
Obviously the list is not generic and could not be recommended for all projects, but at least it is useful for small and medium open-source solutions to keep sources clean and size-optimized.   

2011-08-30

Hard SVN branch switch for Git

I have been working with Git through git-svn bridge in SVN based organization together with Alexander Beletsky. We practice Git to solve lots of SVN issues.
There are several tricky moments with git-svn, for instance, SVN branch switching. If there is not quite big difference between your git repository and svn repo, you can use this advice.
But when I had returned from vacation, I found this approach was not working. I have missed one iteration so my Git repository should jump over huge list of changes. Saying in another words, I need just replace my "master" branch with SVN's latest iteration branch.
This solution helped me:

1. Create new git-svn branch.
git config --add svn-remote.SvnRemoteNewBranch.url https://svn/branches/NewIteration
git config --add svn-remote.SvnRemoteNewBranch.fetch :refs/remotes/SvnRemoteNewBranch
git svn fetch SvnRemoteNewBranch
git checkout -b LocalNewBranch -t SvnRemoteNewBranch
git svn rebase SvnRemoteNewBranch 

With it you will get the latest changes from svn to the "LocalNewBranch".
2. Replace "master" branch with svn's one.
git merge -s ours master
git checkout master
git merge LocalNewBranch  

This is it! Your "master" branch has the latest changes.