Jump to content

Quick and dirty GIT Guide!


Recommended Posts

  • Replies 106
  • Created
  • Last Reply

Top Posters In This Topic

$ git pull
fatal: Not a git respository

and I dont have Git Bash Here Option on my mangos folder...

if you don't have that option and you are on windows then you didn't install something correctly. please verify that you have correctly installed msysgit and followed the instructions. i have been pulling form the git repo now for a week and have had no issues.

regards,

jdg

Link to comment
Share on other sites

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?

git checkout commit-id

example:

git checkout 639a811b8182e39ff1f0b38157d740b7329a2489

and then to create a new branch for that commit, do git checkout -b branchname

Link to comment
Share on other sites

git checkout commit-id

example:

git checkout 639a811b8182e39ff1f0b38157d740b7329a2489

and then to create a new branch for that commit, do git checkout -b branchname

That's the better approach.

But it's possible to simulate svn in this way .. using

git-reset --hard 639a811b8182e39ff1f0b38157d740b7329a2489 on current branch.

Link to comment
Share on other sites

i have an problem with Git Bash.exe, every time i start is it show up but then it disapear in 1 sec so i cant type any commands or i cant even see what the error is. can some one help me?

edit: i found the error now : C:/Pogram Files\\Git\\sh.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 6

edit: i already found what the problem was, i use version 1,6 instead of gitmsys

Link to comment
Share on other sites

git checkout commit-id

example:

git checkout 639a811b8182e39ff1f0b38157d740b7329a2489

and then to create a new branch for that commit, do git checkout -b branchname

Ok, I don't mean to beat anyone's brain into a bloody pulp... but I guess that something I'm not getting here is where do we get the commit id's from? before it was a simple revert to version... now we are pulling this commit id... from where?

:confused:

Link to comment
Share on other sites

Ok, I don't mean to beat anyone's brain into a bloody pulp... but I guess that something I'm not getting here is where do we get the commit id's from? before it was a simple revert to version... now we are pulling this commit id... from where?

:confused:

You will see them here http://github.com/mangos/mangos/commits/master to the right of every commit.

Or if you use the "git log" command you will see the commit id on the top of every commit

Instead of copying the whole 40-hexdigit id you can copy only the first 5 digits too if you want so instead of doing this:

git checkout 964f7bc31fcade7e42a419c34e91dba2fb005e0c

you can do

git checkout 964f7

Link to comment
Share on other sites

Ok, I don't mean to beat anyone's brain into a bloody pulp... but I guess that something I'm not getting here is where do we get the commit id's from? before it was a simple revert to version... now we are pulling this commit id... from where?

:confused:

Oh my god! Was I being a blockhead! forgive me oh God of Development where ever you may be... I am such an idiot... here I am browseing all around the github and staring me right in the face is the branch id, commit id and the parent id... Man, I really need a vacation.

Link to comment
Share on other sites

You will see them here http://github.com/mangos/mangos/commits/master to the right of every commit.

Or if you use the "git log" command you will see the commit id on the top of every commit

Instead of copying the whole 40-hexdigit id you can copy only the first 5 digits too if you want so instead of doing this:

git checkout 964f7bc31fcade7e42a419c34e91dba2fb005e0c

you can do

git checkout 964f7

7 characters/digits is recommended minimum (and used by many apps) ..

Link to comment
Share on other sites

7 characters/digits is recommended minimum (and used by many apps) ..

Ah, okay. In the guide I read somewhere they said 5, but 7 is probably better. Anyway, I usually copy the whole 40-hexdigit, it doesn't take much longer :P I don't really see the reason to shorten it, but I guess it's better when you have to memorize it.

Link to comment
Share on other sites

Ah, okay. In the guide I read somewhere they said 5, but 7 is probably better. Anyway, I usually copy the whole 40-hexdigit, it doesn't take much longer :P I don't really see the reason to shorten it, but I guess it's better when you have to memorize it.

It's better when you want 2-3 hashes to fit on a 80char line.

Like git-diff 4bcd3f6...564dda8

Link to comment
Share on other sites

give it any command to bring the old ref id like 6767 back? instead of the long hex id

No git works on a different principle than svn. Basically when you make changes to code it makes a hash of all the files in your local git repo. From what i've read this eliminates the chances of duplicate commits as any commit that has the exact same source will have the same hash. At any rate that was too much info, the short answer is no there is not any way to get git to give you linear revision numbers as svn does.

Regards,

JDG

Link to comment
Share on other sites

No git works on a different principle than svn. Basically when you make changes to code it makes a hash of all the files in your local git repo. From what i've read this eliminates the chances of duplicate commits as any commit that has the exact same source will have the same hash. At any rate that was too much info, the short answer is no there is not any way to get git to give you linear revision numbers as svn does.

Regards,

JDG

The hash is in fact generated from something little different (because if it would be only based on files, you'd got twice the same hash in a revert commit), but you've got the point :)
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