Виртуальная песочница (тм)

Saturday, December 8, 2012

Git on Windows - quick start tutorial

Summary
1. Install Git
2. Use the following commands:

git init
git config user.name Alex
git config user.email alex201212012120@mailforspam.com
git config core.editor "'C:/Programs/NotePadPlusPlus622min/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
git add *.*
git commit -m "Commit message"
git status
git log
git remote add my-bitbucket-repo-via-https https://bitbucket.org/username/repositoryname
git remote -v
git push --help
git push my-bitbucket-repo-via-https master



Note #1. Forward Slashes
Notice the forward slashes in the following command:
D:\test>git config core.editor "'C:/Programs/NotePadPlusPlus622min/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

Note #2. Install Notepad++
You'll have to install Notepad++. Смиритесь с этим. Standard notepad somehow doesn't find the ./git/COMMIT_EDITMSG file. "EmEditor Free" finds the file, but the command line doesn't wait for it. Notepad++ just works. Minimalistic installation of Notepad++ only takes 3Mb of HDD (comparing to more than 75Mb for Git), and it is a good text editor anyway. So, устанавливайте - не пожалеете (фриварь).

Tried everything from StackOverflow with Notepad and "EmEditor Free". It didn't worked. Modified EDITOR environment variable, tried $* and %*, double quotes, single quotes... Ничего не помогало. Очень понимаю одного из комментаторов:
I've had difficulty getting git to cooperate with wordpad, KomodoEdit and pretty much every other editor I give it. Most open for editing, but git clearly doesn't wait for the save/close to happen. As a crutch, I've just been doing a
git commit -m "Fixed the LoadAll method"
to keep things moving. Tends to keep my commit messages a little shorter than they probably should be, but clearly there's some work to be done on the Windows version of git. The GitGUI also isn't that bad. It takes a little bit of orientation, but after that, it works fairly well.
Note #3. Double quotes instead of single quotes
Note that under Windows double quotes should be used instead of single quotes in the git commit command. The book does not mention it, SuperUser.com does.

No comments: