Git guidelines

VCMI has migrated to Github. The new repository address is: github.com/vcmi/vcmi

[size=150]Guidelines:[/size]
Initially, the workflow will be loosely based on the Gitflow recommendations:

  • the main development branch is called “develop” (equivalent to the SVN trunk)
  • the “master” branch will be kept in a stable-release quality (typically pointing to the last released build)
  • before the stable release, a separate branch is created. The fixes made to develop are merged to it (but no risky changes).
  • the branches dedicated to a some feature development should be named “feature/FeatureName”. Similarly, the branches aiming to fix a specific bug should be named “bug/BugNr”.

Gitflow references:
atlassian.com/git/workflows … ow-gitflow
nvie.com/posts/a-successful-git-branching-model/
[we won’t do the whole thing now because I doesn’t seem reasonable for our scale]

If you have any suggestions about the workflow changes we should adopt, it is a good place to share them. I don’t want to change too much at once — we just migrated rfom SVN, to first I’d like to see how the whole Git thing settles dow — and during this time, we should consider which model we want to strive to.

[size=150]Basic Git usage tutorial:[/size]

  1. SVN-like
    First “pull”. Make chcanges. Then “commit” and “push”. [If you are working from command line, then before “commit” the "add"will be needed to select what changes will be committed.]
    Obviously, this works only if you have privilage to push to the repository — so you need to be an accepted team member.

  2. Pull-request based
    Fork the repository. Make changes, push them to your fork. Open a pull request and wait for one of us to review the code and eventually merge changes to the main repo.

If you are a team member, you don’t have to fork — you can just create a separate branch and push changes with it. Then it is possible to open a pull request for the branch (and have it checked/merged by someone else). Or, if you don’t want code review, just merge it.
help.github.com/articles/using-pull-requests

[size=150]Visual Studio and Git[/size]
Visual Studio 2013 has built-in Git support. It isn’t complete, but having most important Git commands integrated in IDE is very convienent. Update 2 brings a few handy features (blame).
Visual Studio 2012 [which you shouldn’t use anyway] can similar (though more limited) features through official plugin. visualstudiogallery.msdn.microso … 724bdb980c
Because Visual Studio support is limited, I recommend having installed some else Git client. Eg TortoiseGit code.google.com/p/tortoisegit/

Starting with VS Git plugin
Open Team Explorer. Click the “Connect to Team Projects” icon at the Team Explorer’s top bar. Make sure that the “Local Git Repositories” node is expanded and click the “Clone” below it. Enter the repo address ( github.com/vcmi/vcmi ) in the first field, and your desired path for the repo to be placed. Click clone. Done.

The Team Explorer contains a few main panels (available when the “Home” top bar button is pressed):

  • Changes panel is used to browse uncommitted changes and committing them
  • Branches panel allows to quickly create, merge, and switch branches.
  • Unsynced Commits panel is for performing push and pull operations. The “sync” button does the “pull-push” combo.
  • Settings are settings. Make sure that the entered data is correct (it is used identify commits).

Further reading: msdn.microsoft.com/en-us/library … 50437.aspx
Further watching: microsoftvirtualacademy.com/ … jump-start

[size=150]Command-line / general Git tutorials:[/size]
There are tons of tutorials, so I won’t repeat them:
rogerdudler.github.io/git-guide/
git-scm.com/book
vogella.com/tutorials/Git/article.html

great move,hope VCMI grow more better.

Can someone update
wiki.vcmi.eu/index.php?title=How … I_(Windows
?
There is no detailed instruction what to do with GIT.

Done, apart from the screenshots. I’ll do them, when I’ll be updating whole tutorial to VS 2013.

Thanks!
GIT part worked, I got source files from it.

I tried to compile project on VS 2013 right now. But it gives errors that it cannot find Boost files included (there is Linux slash instead of windows slash in relative paths to hpps).
I found this receipt
stackoverflow.com/questions/1982 … ual-studio
But my VS 2013 Express don’t have this Linux directory.
What am doing wrong? Or maybe there some trick not covered in current manual?

This is irrelevant. VS works both with forwards and backwards slashes.

This is absolutely not applicable in our case.

If the compiler says it cannot find the include, it can mean two things:
a) you don’t have Boost on the disk
b) compiler doesn’t know where you have put the Boost libraries

Tutorial covers in detail how to add path to includes locations list:
wiki.vcmi.eu/index.php?title=How … ry_folders

If you went along theese instructions and it still does not work, then please explain exactly what have you done, ie. where have you installed Boost and what path have you added (and where).

PS. Have you got the Boost from sources from the Git? The 1.55 version doesn’t work and will break compilation later.

Maybe it’s because Boost 1.55 doesn’t work. I installed binaries to “C:\local\boost_1_55_0”.
If I correct slashes in vcmi project (in Global.h), then VS 2013 starts to complain about slashes in boost HPPs.

How can I obtain and compile Boost from GIT?

It’s not because of that. Compilation will fail later.

Is “C:\local\boost_1_55_0” the path you have added to the includes paths in properties? Does “C:\local\boost_1_55_0” contains subfolder named “boost” with .hpp files?

Slashes are OK either way. What makes you think that VS complains about them?

Please paste the exact code changes you make and the actual compile error. This might give us a clue.

Follow the instructions from their wiki:
svn.boost.org/trac/boost/wiki/T … dularBoost

git clone --recursive [email protected]:boostorg/boost.git modular-boost >clone.log
cd modular-boost
.\bootstrap
.\b2 headers

After that you should be able to issue

b2 address-model=32 --toolset=msvc-12.0 --stagedir=./stage32

like prescribed in our wiki.

Thanks for answer.
Lost about 1 hour and beginning to think I am stoopid. But I still didn’t managed to get boost cloned and compiled.
OK, will try tomorrow, maybe. there are some problem with generating ssh id_rsa key and clone doesn’t work.
And by the way - [email protected]?

Actually the whole ssh keys thing is just a needless bother on windows. You can use https (instead of ssh as Boost wiki suggests).

Instead of the first command use:

git clone --recursive https://github.com/boostorg/boost.git modular-boost

This should be enough, no accounts nor keys involved.

Great, this worked, boost is now seems to be cloned! Thanks for help.

But problem with VS2013 non-compiling headers still left. I’ll mess around when will come home today. Maybe post some screenshots to solve problem.

All right, somehow i finally managed to get VCMI compiled (VS path settings didn’t work, so i just copied libraries and headers of boost to appropriate folders in vcmi trunk.

Next question about GIT. How can i upload commits to GIT if any?
I have registered on GIT, so i have login/password.

Read 1st post in this thread?

Short version:

  1. Clone vcmi repo on github. Required for those who don’t have write access.
  2. Clone created fork to your system
    <write & test your changes>
  3. Commit to local repository
  4. Push changes to github
  5. Create pull request to get your changes accepted into repo.

Note that if you want to get some new feature into vcmi it is better to discuss it on forums first.

I’m starting to hate Git. It has many options, but none of them seem to work.

Like what? I already found git version of all my use cases. And all seems to work just fine.

From my point of view git is actually an improvement - finally easy to use branches instead of submitting 1000+ lines in size commits just because you want to avoid breaking trunk, easy to use pull requests as opposed to long process of applying patches.

So far the only problem seems to be 1-2 missing pieces/weird behaviors in QtCreator git plugin but console with proper autocomplete replaces them just fine.

There are many ways to submit a commit, but using Tortoise Git psuh didn’t work for me at all. Git commit tool worked, however.

Now, I created private branch “WarmysBackup”. It’s available both in repo and in my system. The thing is, switching to that branch does not switch actual code and I’m left with default config from develop branch, which won’t work for me.

At the same time I didn’t get error messages about these. It’s just all confusing.
Will need to spend a lot of time to learn about all Git functions… when I find it.

“commit” and “push” are two totally different operations.
First you do commits but they are stored locally. The “push” simply tells Git to submit commits from your local repo to the external one (the one you have cloned, ie. Github vcmi repo or your fork of it).

If this doesn’t work for you, please give more details (what commands have you issued, what is the error message) and I’ll try to help.

I’m not sure what you did or what you wanted to see, so I’ll try to give a general advice.

Remember that there are two separate repositiories: the vcmi one hosted on Github and your local copy that resides on your disk. If you created your local repository by cloning the VCMI, you have created a certain relation between them. (the Github repo is called “remotes/origin” and it’ll be target of push/pull operations)

Similarly, there are two separate “WarmysBackup” branches as well (the local one called “WarmysBackup” and the external Github one visible to you as “remotes/origin/WarmysBackup”. If switching to “WarmysBackup” doesn’t change the actual code (ie. it does not show changes visible on Github and Git doesn’t show any changes), it might mean that you need to “pull” changes (so the commits from Github are moved to your local version of branch). Similarly, if the Github branch doesn’t show your local commits, you have to “push”.

Thanks for reply. It turns out some of the changes I expected were missing, but once I fixed them manually, now everything works nicely.

Lets make “develop” branch history more linear. Please prefer fetch+rebase+push and not just pull+push. Merge commits between local and remote “develop” branches are useless junk.

you can write “git pull --rebase origin”