Here are a couple notes on how I use Git with Visual Studio and a shared folder as a remote repository.
Let's walk trough the basic setup steps.
Create a new visual studio project
Add a nice .gitignore file to the project folder. Good example: git ignore file
Open git command line console and initialize your project in the project folder .. code-block:: bash
git init git add git commit -m "add initial project files"
Outside the project directory, create a bare repository
git clone --bare ProjectName ProjectName.git # note common naming convention for bare repo
Copy bare repository to a remote location (in my case a file share where other developers have access)
Change into project folder and update remote remote repo location
git remote add origin /x/Shared/git/ProjectName.git
Now add development branch (take a look here for a good branching model).
git checkout -b develop master
Push changes (including branches) to the remote repo
git push -all
Simple Development with Branching Model
Now, when ready to begin some development:
First, create a new branch off develop branch and begin coding
git checkout -b feature-NewSprocket develop ... git commit -m "Added new sprocket code"
And when finished merge back, delete, and push (don't forget to commit final changes)
git checkout develop git merge --no-ff feature-NewSprocket git branch -d feature-NewSprocket # deletes branch git push origin develop # push develop branch to origin
Simple Steps for Release Cylce
Later, here are basic release steps:
Create your release branch off develop
git checkout -b release-1.0 develop
When ready to finalize, check everything in and bump release info, then merge to master
git checkout master git merge --no-ff release-1.0 git tag -a 1.0 git push # do we need to specify --tags or --all here to ensure the tag gets pushed to the origin?
Don't forget to merge any changes in release back into develop as well before deleting
git checkout develop git merge --no-ff release-1.0 git branch -d release-1.0
It's a good idea to save your solution and/or project file before you commit as some of the changes to the .slc and .proj files don't get written immediately. This can cause odd behavior and necessitate amending your last commit to include apparent missing files or project changes.