For a long time I have been writing one program. To save all the data using backups. But I decided to use a version control system. And so what I want from the version control system:

  1. It should work on the local computer and under Windows.
  2. Have both a console and GUI interface
  3. Integrated with Visual Studio

And then there are difficulties: any article for dummies suggests either using a githab, or installing and setting up a software break (database, web server ...). And who can tell (or throw a link at me) how to quickly and easily configure a version control system (git preferable) with a server on a local computer?

  • one
    If you put a studio in 2013 or 2015, then she asks during the installation - "git to put?" Immediately solves a bunch of questions. If you really want some kind of integration into the studio - try this gitextensions.imtqy.com - KoVadim

2 answers 2

1. Installation

Git does not need a server. Under Windows, put this: gitforwindows.org . There is a 32-bit and 64-bit version.

A git-bash unix-like console and a GUI tool will be installed along with git. You can use Visual Studio as another GUI. There are many other GUIs, but with the ability to work through the console and the presence of a full-fledged IDE, they will not be useful.

1.1. Integration with Visual Studio

If you need integration with Visual Studio, you can install http://gitextensions.imtqy.com/ . Included is a plugin for VS. (Link from KoVadim comment )

2. Startup and initial configuration:

Open the git-bash command shell: right-click on an empty space in any folder and select git bash here .

Perform a basic configuration , you need to do it once. Use your name and your mailbox. If you are setting up Git in the workplace, you most likely need to use work mail.

git config --global user.name "John Doe" git config --global user.email johndoe@example.com 

And to use CRLF line endings, as is customary in Windows:

 git config --global core.autocrlf true 

Instead of console commands, you can edit the config file in any text editor (local is located in %папка_проекта%\.git\config , global in C:\Users\%имя_юзера%\.gitconfig ).

3. Start using

If git bash is already open, go to the project folder:

 cd С:/путь/к/проекту 

Or right-click on an empty space in the project folder and select git bash here .

Now, to create a local repository and thus start project version control:

 git init 

Documentation

More on this topic:

Documentation entry point: https://git-scm.com/book/en/v2

  • one
    Still, I would recommend to put another Git Extensions. It is very convenient to preview the changes there - it removes problems like "commited to git, I don’t know what, conflicts are coming up now" - Pavel Mayorov
  • @PavelMayorov if you want, add a recommendation somewhere near the paragraph about VS. I think it will be quite appropriate. - Nick Volynkin
  • I am not as beautiful as you, I will not articulate ... - Pavel Mayorov
  • @PavelMayorov why do you recommend Git Extensions? Is it superior to various other GUIs or is it not just a GUI? - Nick Volynkin
  • one
    It allows you to see the status of files, diffs, add, reset (both in unstage mode and hard mode) and commit in one window. In addition, there you can work with individual lines of the file - much more convenient than through the command line; I often use this feature for .csproj files. - Pavel Mayorov

Not the most canonical option, but for GUI lovers it’s very good - https://tortoisegit.org/ (available in Russian).

Everything you need to work will be installed locally, including git itself. There are gui, which you can use at first, and then (optionally) go to the command line.

Fast start:

  • download / install tortoisegit
  • right click on your folder, then "Create a repository here"
  • and when you need to save the work, right-click on the folder and "Commit"

An example of viewing the commit log:

enter image description here

  • You have to be careful with programs that integrate into Explorer. They slow things down pretty much. - Pavel Mayorov
  • @PavelMayorov is it about badges that are drawn over file icons? (slowdown) - Vladimir Gamalyan
  • And they include. - Pavel Mayorov