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.

TeamExplorerHome

Click the settings option.

TeamExplorerSettings

Then click Repository Settings.

TeamExplorerRepositorySettings

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 user.name "UserName"
$ git config --global user.email "venkat@VenkatRangala.com"

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"

Source: http://wikgren.fi/compare-diff-branches-in-tortoise-git-or-how-to-preview-changes-before-doing-a-merge/

Useful Links

http://juristr.com/blog/2013/04/git-explained/

https://dzone.com/articles/git-visual-studio-and-net

https://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c

 

Change Git password 

https://cmatskas.com/how-to-update-your-git-credentials-on-windows/

Tags:

Comments are closed

TextBox

Tag cloud

    RecentPosts