Git stuff

by Admin 15. March 2016 12:50

Using Visual Studio to add a .gitignore file

Inside of Visual Studio open the Team Explorer window. If you don’t already have it open use the quick launch in the upper right hand side of the window to search for it. If it is not already on the Home page click the house icon in the top of the Team Explorer window.


Click the settings option.


Then click Repository Settings.


Now click the add link next to the Ignore File description. This will add the .gitignore file will all the defaults set for things that should be ignored. You could add the file manually, but then you would not get the nice set of default values. If you do decide to add the file manually this repo contains all the defaults that should be ignored for a project using .NET/Visual Studio.

Now that the file exists check it in.

Stop tracking files that should be ignored

To stop tracking the files in the ignore file open a command prompt and navigate to the directory that contains your solution file (.sln) and run the following commands.

git rm -r --cached . 
git add .
git commit -am "Remove ignored files"

That seemed to do the trick for me.


Setting Identity in GIT
$ git config --global "UserName"
$ git config --global ""

To unblock the proxy

$ git config --global http.proxy "http://xx.xx.xx.xx:8080/"
$ git config --global https.proxy "http://xx.xx.xx.xx:8080/"

gitignore file creation in Windows
$ touch .gitignore

Create a Branch in GIT
$ git branch <BranchName>

To switch to the branch name
$ git checkout <BranchName>    [Note: If you cant see the branch name, try doing a git fetch]

Create Branch & checkout

git checkout -b "<BranchName>"

Add a file from command in GIT
$ touch <filename>
Eg: $ touch styles.css
A new styles.css file gets added to the git repository

$ git checkout master
Will switch you to the main branch

$ git mergetool
uses a tool like tortisegit or winmerge to perform merge a little more effeciently


Best way to merge a git branch into master

My work on test branch is complete and I am ready to merge it back to master

git checkout master

git pull origin master

git merge test

git push origin master


Git Compare branches

For those of you on Windows using TortoiseGit, you can get a somewhat visual comparison through this rather obscure feature:
    Navigate to the folder you want to compare
    Hold down shift and right-click it
    Go to TortoiseGit -> Browse Reference
    Use ctrl to select two branches to compare
    Right-click your selection and click "Compare selected refs"


Useful Links


Change Git password


Comments are closed


Tag cloud