Jump to content

Quick and dirty GIT Guide!


Recommended Posts

  • Replies 106
  • Created
  • Last Reply

Top Posters In This Topic

hmmm I keep getting the error:

%myname%[at]%mycomputer% /d/sources/MaNGOS

$ git pull

Permission denied <publickey>.

fatal: The remote end hung up unexpectedly

Obviously doing something wrong but it's not obvious to me

like TheLuda said it sounds like your're trying to pull from the secure side of the repo. be sure that when you added the repo you did the following commands as follows

git init

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

git pull .

for the person that posted above that they are stuck at the initialization make sure you do these commands one at a time and they should work fine.

regards,

jdg

Link to comment
Share on other sites

and how to create one? xP

Commit your changes to your local Git repository. Then export your changes to a patch file:

git-format-patch -1

The above example exports the most recent commit. git-format-patch has many options.

See http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html for more explanations.

By default, git-format-patch will create a file with a name like 0001-my-changes.patch.

(Disclaimer: im a Git-n00b, so im learning this as we go :P i hope its correct! lol)

Link to comment
Share on other sites

you should be able to just use the following:

git pull .

the period is intentional so use it :).

regrads,

jdg

$ git pull
remote: Counting objects: 9, done.←[K
remote: Compressing objects: 100% (5/5), done.←[K
remote: Total 5 (delta 4), reused 0 (delta 0)←[K
Unpacking objects: 100% (5/5), done.
From git://github.com/mangos/mangos
  9b52097..7511c75  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.

and sources still old. after i run:

$ git pull origin master
From git://github.com/mangos/mangos
* branch            master     -> FETCH_HEAD
Updating 9b52097..7511c75
Fast forward
src/game/ThreatManager.cpp |   15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)

and ThreatManager.cpp now with changes.

p.s. i use msysgit on win xp. my config in .git directory

[core]
   repositoryformatversion = 0
   filemode = false
   bare = false
   logallrefupdates = true
   symlinks = false
   ignorecase = true
[remote "origin"]
   url = git://github.com/mangos/mangos.git
   fetch = +refs/heads/*:refs/remotes/origin/*
[gui]
   geometry = 923x492+154+157 204 171

Link to comment
Share on other sites

About old patches. You can make small chnages and let use its with git.

For example you have in patch for file:

Index: Creature.cpp

===================================================================

--- Creature.cpp (revision 6759)

+++ Creature.cpp (working copy)

You need chnage it in way:

Index: src/game/Creature.cpp

===================================================================

--- a/src/game/Creature.cpp (revision 6759)

+++ b/src/game/Creature.cpp (working copy)

a/ b/ - need just add

src/game/ - git understand only full file path from project sources root, so you must be sure that file name include it.

Do it for all files in patch and this can help in apply old patch.

Ofc, possible also changes conflicts, etc. but this another story ;)

Link to comment
Share on other sites

man that took a minute. but i sure do like the simple cheack out. with snv..

wish you could use both.. so i could just use snv.. this has to much typing im lazzy. and i hate that i have to learn git now. Cry boo hoo. o well.. ill worrie about it once your at 3.0.2

Link to comment
Share on other sites

you also can apply svn-style patches oO

git apply path/to/patch

and if your patchfile looks like this: "Index Creature.cpp" you have to change the directory to mangos/src/game/

if the file looks like "Index: src/game/creature.cpp" you need to change directory to mangos/

at least with linux this works..

also at linux you can simply make patch -d . -p0 < path/to/patch

Link to comment
Share on other sites

Ive got a small problem here, ive gone though this thread and have nearly encountered every error posted. None of the submitted resolutions seem to help. Heres my output:

OS - windows vista

Notice these things: The download stops on this line - From git://github.com/mangos/mangos - gives no error, then reminds me next time i try that it is up to date... the third attempt of the git pull origin master was from the clone URL.

Perhaps im understanding this process wrong, but I thought this pulls source into your designated directory. The largest file in the git directory is 15 megs, and is named pack-2a42eed57d36b9e384f0977fea4e02d8d16b042c.pack -> I think im getting stuck on a step here.

Any help would be appreciated, thanks.

C:\\Users\\wizardanim>git init
Initialized empty Git repository in C:/Users/wizardanim/.git/

C:\\Users\\wizardanim>git remote add origin git://github.com/mangos/mangos.git

C:\\Users\\wizardanim>git pull .
fatal: Couldn't find remote ref HEAD
fatal: The remote end hung up unexpectedly

C:\\Users\\wizardanim>git pull origin master
remote: Counting objects: 3858, done.←[K
remote: Compressing objects: 100% (3051/3051), done.←[K
remote: Total 3858 (delta 950), reused 3592 (delta 762)←[K
Receiving objects: 100% (3858/3858), 14.64 MiB | 468 KiB/s, done.
Resolving deltas: 100% (950/950), done.
From git://github.com/mangos/mangos
* branch            master     -> FETCH_HEAD

C:\\Users\\wizardanim>git pull origin master
From git://github.com/mangos/mangos
* branch            master     -> FETCH_HEAD
Already up-to-date.

C:\\Users\\wizardanim>git pull origin master
From git://repo.or.cz/getmangos
* branch            master     -> FETCH_HEAD
Already up-to-date.

C:\\Users\\wizardanim>

Link to comment
Share on other sites

For people having the same problem that I was...

use this following line:

C:\\Users\\wizardanim>git clone git://github.com/mangos/mangos.git
Initialized empty Git repository in C:/Users/wizardanim/mangos/.git/
remote: Counting objects: 3858, done.
remote: Compressing objects: 100% (3051/3051), done.
remote: Total 3858 (delta 950), reused 3592 (delta 762)
Receiving objects: 100% (3858/3858), 14.64 MiB | 599 KiB/s, done.
Resolving deltas: 100% (950/950), done.
Checking out files: 100% (3330/3330), done.

C:\\Users\\wizardanim>

Worked just fine... Sorry for the extra post

Link to comment
Share on other sites

About old patches. You can make small chnages and let use its with git.

For example you have in patch for file:

You need chnage it in way:

a/ b/ - need just add

src/game/ - git understand only full file path from project sources root, so you must be sure that file name include it.

Do it for all files in patch and this can help in apply old patch.

Ofc, possible also changes conflicts, etc. but this another story ;)

Well, Any idea how to apply patches to source by using git?? Does git even support it??? Do I have to use git to retrieve source and then use tortisSVN to apply various patches???

They quote taken above from a post made earlier by vladimir explains how to edit old patches to work with git.

regards,

jdg

Link to comment
Share on other sites

About old patches. You can make small chnages and let use its with git.

For example you have in patch for file:

Index: Creature.cpp

================================================== =================

--- Creature.cpp (revision 6759)

+++ Creature.cpp (working copy)

You need chnage it in way:

Index: src/game/Creature.cpp

================================================== =================

--- a/src/game/Creature.cpp (revision 6759)

+++ b/src/game/Creature.cpp (working copy)

a/ b/ - need just add

src/game/ - git understand only full file path from project sources root, so you must be sure that file name include it.

Do it for all files in patch and this can help in apply old patch.

Ofc, possible also changes conflicts, etc. but this another story ;)

Well, Any idea how to apply patches to source by using git?? Does git even support it??? Do I have to use git to retrieve source and then use tortisSVN to apply various patches???

They quote taken above from a post made earlier by vladimir explains how to edit old patches to work with git.

regards,

jdg

Link to comment
Share on other sites

For people having the same problem that I was...

use this following line:

C:\\Users\\wizardanim>git clone git://github.com/mangos/mangos.git
Initialized empty Git repository in C:/Users/wizardanim/mangos/.git/
..edit..
C:\\Users\\wizardanim>

Worked just fine... Sorry for the extra post

That works for me, thanks.

Link to comment
Share on other sites

×
×
  • 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