In GIT you can have multiple repositories.
A classical example is 1 remote repository, to which all the developers push.
Every developer also has a local repository. This is usually in the working directory.

To know the remote repositories:
git remote -v
This will show the name and url of the remote repositories. The default name of a remote repository is origin.

Git clients
- Git GUI (comes default with GIT)
- Tortoise Git
- Smart Git
- Source Tree
- GitKraken
- Visual Studio

Git workflows

GitHub Flow
Too simple. Just check pull request.
GitLab Flow

Convert a SVN repository to Git

Convert the repository

If the you have a local SVN reposit, you need to expose it by the svn: protocol. You can do this with svnserve:
svnserve.exe -d -r pathToMyLocalSvnRepositories

By default, the username of SVN will be taken. This means it won't have an email. In Git, a user normally has an email.
So if you push to a server like eg. VSTS, this system will create a virtual email address for you.
If you want to manage the users for Git, you first need to extract the SVN users, first extract all the users of the commits:
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
The users will now be in the authors-transform.txt file like name = name <name>
Edit this file so you have the descriptions you want like name = full name <moc.liam|eman#moc.liam|eman>

Then clone the svn repository to Git:
Without authors file:
git svn clone svn://localhost/myLocalSvnRepository —no-metadata —stdlayout pathToMyNewGitRepository
With authors file:
git svn clone svn://localhost/myLocalSvnRepository —no-metadata -A authors-transform.txt —stdlayout pathToMyNewGitRepository

The tag —stdlayout means you have a classical SVN setup with tags, branches and trunk folders. It is possible to change this.
Normally, the SVN trunk will be renamed to the Git master.

Push to your remote repository

For creating a bare remote repository in VSTS, see Varia - Visual Studio Team Services.
git remote add origin https://{account}{name repository}
git push -u origin —all

I noticed in this way the tags aren't shown in VSTS.
Maybe you need to do also
git push origin master —tags?

Setup - start without existing project

Create the remote repository

Create a folder for the repository.
Right click on the folder: Git Create repository here
Check 'Make it bare (No working directories)'.

If you only need a local repository, you can't clone a remote repository as in the next step.
In this case you have to execute this but don't check 'Make it bare (No working directories)'.

Create the local repository in the working directory by cloning the remote repository

Create a folder for the working repository.
Right click on the folder: Git Clone.
The URL should contain the the path/url of the remote repository.
The directory should be the directory you clicked upon.

Setup - start with existing project

Daily use

git config —global "Your Name"
git config —global "moc.revetahw|liame_ruoy#moc.revetahw|liame_ruoy"

git add hello.html : stage the file hello.html
git commit -m "First Commit" : commit the staged files to the repository with the message "First commit".
git status : shows the current status of the local repository.
git checkout: undo changes

Copying changes to a repository

Git Commit …: Copies the made changes to the local repository.
Push: Copies all the changes committed to the local repository, to the remote repository
Copying changes to a SVN repository: SVN DCommit

Getting changes from a (remote) repository

Pull will merge remote branch change to local branch which tracked with remote branch.
Fetch just get change from remote branch and never merge.
Getting changes from a SVN repository: SVN rebase

Remove tag

$ git tag -d release01
$ git push origin :refs/tags/release01

Other commands

git init : create a new repository
git —version : shows the version of git you are using
git config —list : shows the Git configuration settings in a list

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License