Jump to content

Quick and dirty GIT Guide!


Recommended Posts

Ok, I've looked all over this topic and have looked through Git's documentation. I used to be able with Tortoise to "Update to Revision" and then put in a revision number to update to. Anyone know how to do that with Git?

Thank you for any help you can lend in advance.

Shinzon

NOTE: Perhaps this should just be combined with: http://getmangos.eu/community/viewtopic.php?id=4099 since it's already classified as a guide.

Link to comment
Share on other sites

  • Replies 106
  • Created
  • Last Reply

Top Posters In This Topic

hi guys i have one problem and dunno how to solve it so ill ask u :)

i downloaded source no problem applied my custom patches everything worked fine but now when i want to update (git pull) i get error: Entry 'src/game/ObjectMgr.cpp' not uptodate. Cannot merge.

i know what it means but i have no clue how i can resolve this problem... it didnt create files like SVN my version their version... so i can see whats wrong and fix it... is there some kind of command to see whats wrong and resolve it?

thats one thing and other thing why it wants to update all my patched files? do i have to apply patches after every update?

http://getmangos.eu/community/viewtopic.php?id=4242

Link to comment
Share on other sites

I have a question: Is it possible to visualize the conflicts when applying a patch? Something like TortoiseSVN style, resolving conflicts manually, not just some bash lines: "error at line 124" whitespace trailing or something.

I've read in this post http://getmangos.eu/community/viewtopic.php?id=4276 how to resolve conficts by making some modifications in the git config file, but that didn't help me.

In short, after making

git apply <path_to_path>
how can i see what files were succesefuly patched, and if not resolve conflicts manualy in a graphic interface?
Link to comment
Share on other sites

I have a question: Is it possible to visualize the conflicts when applying a patch? Something like TortoiseSVN style, resolving conflicts manually, not just some bash lines: "error at line 124" whitespace trailing or something.

I've read in this post http://getmangos.eu/community/viewtopic.php?id=4276 how to resolve conficts by making some modifications in the git config file, but that didn't help me.

In short, after making how can i see what files were succesefuly patched, and if not resolve conflicts manualy in a graphic interface?

Well I personally don't know if something like that exist, manpage of git-apply doesn't seem to refer to such feature, could be a nice feature request, current git-apply is just a bit enhanced and modified version of GNU patch.

The common way to solve this is to create a branch with a commit the diff was made against, apply it there and then cherry-pick the commit / merge the branch ..

Perhaps git-am has something, but people would have to make patches instead of diffs (and they seem to refuse to accept the fact).

Link to comment
Share on other sites

  • 38 years later...

Ok so seeing how there are several people that are having trouble with git I am putting up this quick and dirty guide to show you how to download and update the master repo to your local pc. (Intended for windows users but linux users can do use this too.)

First of all you will need to download msysgit from this location:

http://code.google.com/p/msysgit/

You will need to run the exe and when you get to the part where you choose the path just leave it on the first option.

Once you have this done start git bash from the shortcut on your desktop. This will bring up a command line much like the one in linux.

first thing to do is run the following commands:

git config --global user.name "YourUserNameOfChoice"  (do this with the quotes)
git config --global user.email YourEmailOfChoice (do this without quotes)

This isn't entirely necessary but do it anyway on the off chance that you later want to make a patch.

Once those two commands are done you need clone the git repo to your local machine. Do that by running the following command.

git clone git://github.com/mangos/mangos.git C:/Projects/MaNGOS

Of course you will change the path to whatever path you wish to save your local repo to. At this point you have cloned or in svn terms updated your local version to the latest master (head) in the public git repo.

Now if you want to update your local repo all you have to do is right click on the folder where you have it choose the Git Bash Here option and run the following command.

git pull

And that's it!

Well I hope this helps some people out.

Regards,

JDG

***EDIT***

As most of the people that read this thread are new to git I decided to add this link. It is a very nice overview of all the essential commands in git and a general idea of how/when to use them. Hope this provides additional help.

http://git.or.cz/gitwiki/GitCheatSheet

Link to comment
Share on other sites

You not need do "git clone git://github.com/mangos/mangos.git" after git init.

In general you or do clone or do init+add+pull

clone will create subdirectory mangos with source

init+add+pull will save sources in current directory.

git init

git remote add origin git://github.com/mangos/mangos.git

git pull

will do all required for get sources.

Just from own expirience when setup git for mangos ;)

Link to comment
Share on other sites

How about Linux instructions?

in linux you will need to install git (varies depending on distro) after it's installed make the directory you want to put the local repo in and cd into that directory. Once there just run the same commands in the order above and that should be it.

regards,

jdg

Link to comment
Share on other sites

When I want to do "git pull", he gave me the message below. I haven't get any kind of source.

Here is the error message:

[email protected] /i/Downloads/Eigener Wow Server/MaNGOS

$ git pull

remote: Counting objects: 3841, done.←[K

remote: Compressing objects: 100% (3034/3034), done.←[K

remote: Total 3841 (delta 936), reused 3595 (delta 762)←[K

Receiving objects: 100% (3841/3841), 14.64 MiB | 44 KiB/s, done.

Resolving deltas: 100% (936/936), done.

From git://github.com/mangos/mangos

* [new branch] master -> origin/master

You asked me to pull without telling me which branch you

want to merge with, and 'branch.master.merge' in

your configuration file does not tell me either. Please

name which branch you want to merge on the command line and

try again (e.g. 'git pull <repository> <refspec>').

See git-pull(1) for details on the refspec.

If you often merge with the same branch, you may want to

configure the following variables in your configuration

file:

branch.master.remote = <nickname>

branch.master.merge = <remote-ref>

remote.<nickname>.url = <url>

remote.<nickname>.fetch = <refspec>

See git-config(1) for details.

[email protected] /i/Downloads/Eigener Wow Server/MaNGOS

$ git pull

You asked me to pull without telling me which branch you

want to merge with, and 'branch.master.merge' in

your configuration file does not tell me either. Please

name which branch you want to merge on the command line and

try again (e.g. 'git pull <repository> <refspec>').

See git-pull(1) for details on the refspec.

If you often merge with the same branch, you may want to

configure the following variables in your configuration

file:

branch.master.remote = <nickname>

branch.master.merge = <remote-ref>

remote.<nickname>.url = <url>

remote.<nickname>.fetch = <refspec>

See git-config(1) for details.

Link to comment
Share on other sites

Both version works fine, thx :)

EDIT: I tried something, which workds unter SVN very great. I deleted a file(addonhandler.cpp) and want to "Update", but he says, that the file is Up to Date and didn't download (addonhandler.cpp) again. (I have this file, don't worry, it was just a test).

How can i make it, that he will download it?

Link to comment
Share on other sites

EDIT: I tried something, which workds unter SVN very great. I deleted a file(addonhandler.cpp) and want to "Update", but he says, that the file is Up to Date and didn't download (addonhandler.cpp) again. (I have this file, don't worry, it was just a test).

How can i make it, that he will download it?

as read recently at another forum: git checkout -f

Link to comment
Share on other sites

i like using folders outside of a programs directy so i took the time to figure out how to do that

do

git --git-dir=%MANGOSPATH%\\.git init
git --git-dir=%MANGOSPATH%\\.git remote add origin git://github.com/mangos/mangos.git
git --git-dir=%MANGOSPATH%\\.git pull

of course replace %MANGOSPATH% with whereever you want to place the files

Ex: C:\\mangos

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use