Git guidelines

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”

I`ve used to TortoiseGit, which missing this option. (And I prefer to review fetched commits before deside what to do with my local changes: rebase or may be branch and merge later)

Tow
In the wiki"how to build VCMI"
I saw the lib files of SDL
it that mean now you develop VCMI by SDL?
as I konw SDL can make the Windows Linux Android IOS all.

Another stoopid question.
I want to start new works on current version of vcmi.
Do i need to create new fork of vcmi and clone it?
Or i can somehow take last vcmi files and replace with them my current fork on github (github.com/Macron1Robot/vcmi) to ensure that my fork is identical to current vcmi state?

No new fork needed obviously. You need just to fetch main VCMI repo to your checkout (then f.e. reset your develop branch to current head) and push to your fork.

I still didn’t managed to reset Macron1Robot/develop fork to original repository vcmi/vcmi/develop
What should I do?
I don’t need any changes in my local folder with vcmi project.
How can I make my github fork identical to original vcmi/develop?

If I will delete my repository with fork, and then make fork again, will it ruin something in vcmi/vcmi?

You don’t need to keep your “develop” branch in sync. How I do it is:

# clone your repo fork (replace xyzz with your github username)
git clone [email protected]:xyzz/vcmi.git
cd vcmi
# add upstream remote, to get changes from VCMI upstream
git remote add upstream https://github.com/vcmi/vcmi.git
# download upstream code
git fetch upstream
# create branch for your feature that you plan to "pull request", based on current upstream develop state
git checkout -b my_totally_awesome_feature upstream/develop
# you're on local my_totally_awesome_feature branch now which contains a "copy" of upstream develop
# now do your changes, commit stuff with "git commit", write reasonable commit messages, etc
...
# by the way, if your feature is taking too long you should do
git fetch upstream
# from time to time and then update your feature branch either with
git rebase upstream/develop
# or
git merge upstream/develop
# this will either rebase your changes on top of current upstream develop branch or merge develop branch into yours
...
# publish your work, this will send your changes to your fork at github
git push -u origin my_totally_awesome_feature

Here’s how it should look like: github.com/xyzz/vcmi/tree/my_to … me_feature

Now green “Compare & pull request” will appear at the top, click it, review your changes and send pull request to VCMI team.

Very big thanks, made first part of commands. So will work on battlefields issue. And then test second part of these commands:-)

Is there any possibility that there will be actual guideline how to setup git/KDevelop etc on Linux (Debian, for example) and how to work with VCMI under Linux?
This MS VS registration troubles me. I would like to mess with Linux.
Or setuped Virtual Box image that can be used right from start on VCMI coding will be good thing.