EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=590)
-   -   Some git stuff (https://www.eqemulator.org/forums/showthread.php?t=36515)

demonstar55 02-17-2013 03:28 PM

Some git stuff
 
Hopefully someone can adapt this to a wiki post, but this should help those get started that might be confused, this will be more of a dump of how to do things :P

Cloning the repo (same as svn checkout)

Code:

$ git clone git://github.com/EQEmu/Server.git
If you don't want the folder to be called Server you can do if you would like it to be called EQEmuServer instead

Code:

$ git clone git://github.com/EQEmu/Server.git EQEmuServer
Update repo (svn update)

Code:

$ git pull
Or more fully (it defaults to the origin remote)

Code:

$ git pull origin
Switching to a branch (example TestBranch)

Code:

$ git checkout TestBranch
The rest of the examples assume you have a GitHub account set up with an SSH key generated (https://help.github.com/articles/generating-ssh-keys), although I think you can use HTTPS URLs instead of GIT URLs if you don't want to use ssh keys.

Forking a repo

On https://github.com/EQEmu/Server click the Fork button as seen in this image: http://i.imgur.com/dOZ5sP4.png

Clone your repo

Code:

$ git clone git@github.com:username/Server.git
Keeping your fork in sync with upstream. After you clone your repo you will see your remote (where you can pull/push from) is only yours, you will need to add another remote that is the upstream repo.

Code:

$ git remote -v
    origin  git@github.com:username/Server.git (fetch)
    origin  git@github.com:username/Server.git (push)

Adding the repo

Code:

$ git remote add upstream git://github.com/EQEmu/Server.git
Code:

$ git remote -v                                           
    origin  git@github.com:username/Server.git (fetch)
    origin  git@github.com:username/Server.git (push)
    upstream    git://github.com/EQEmu/Server.git (fetch)
    upstream    git://github.com/EQEmu/Server.git (push)

(Note: You shouldn't be able to push to the upstream repo)

Update from the upstream remote

Code:

$ git pull upstream
This will pull into a special branch or something, so next we need to merge it

Code:

$ git merge upstream/master
And push it to our fork

Code:

$ git push origin
A nice thing about git is that we can now use Pull Requests instead of posting diffs in the Code Submission forum which means hopefully these things can get merged with the main repo much quicker, since copying the diffs can be a pain and most of the devs don't like to bother with them. It's probably best to create a branch in your fork for each pull request you make, then probably delete the branch after it was merged.

Submitting a pull request

On https://github.com/EQEmu/Server click the pull request button shown here: http://i.imgur.com/3jo905K.png

Then select the appropriate branch that has the changes you wish to be pulled into the main repo http://i.imgur.com/QJPAON5.png

Hopefully this provides enough information for people to get going and contributing more! The GitHub help page is wonderful as well, so use that if you are having trouble.

Git for Windows works well enough on Windows, you can do most of these tasks from the GIT GUI in that (http://msysgit.github.com/)

On Linux just follow your distros instructions for installing GIT

OSX: I have no idea!

Weldarr 02-18-2013 12:30 PM

Some Additional Pointers after spending a little bit of time trying to figure out the Git stuff:


Windows:
1) Download Git Client: http://code.google.com/p/msysgit/dow...r+official+git
a. The only thing you may want to change in the installation is the context menu. I set mine to not install a context menu because I intended to use TortoiseGit instead (Steps below)

http://i.imgur.com/XrPyfxX.png
2) Download TortoiseGit: http://code.google.com/p/tortoisegit/wiki/Download
a. Nothing fancy to do here, just simply go through the installation steps.
3) Accessing EQEmu Source:
a. Make a new folder wherever you want the source to be save to.
b. Right click on that folder and you should now have TortioseGit options.
c. Select Git Clone...

http://i.imgur.com/AlnNtYX.png

d. Type in the EQEmu Source Github address (seen in the picture)

http://i.imgur.com/zFCa95e.png

e. Click Ok and it will pull the source.
3) How to update to latest revision (How to Pull):
a. Right click on Server Folder and go to Git Sync.
b. On the far left side of screen you will see a button that says Pull with a drop down menu. Click on the Pull button and it will update your code to the latest version.

http://i.imgur.com/NTrnyCX.png
4) How to Commit changes (How to Push):
a. You need to have access granted as a developer to commit changes.
b. Right click on the Server Folder and go to Git Sync.
c. In the middle of the screen you will see a button that says Push with a drop down menu. Click on the Push button and it will push your changes to the source.
**Note** I'm not 100% sure on the Push/Pull commands. It seems to be how they work, but I've never used Git before so this is all kind of new to me and I haven't had a chance to test it out yet.

Hope it helps alleviate some confusion that anyone may be having with the migration to GitHub.

- Vaion

demonstar55 02-19-2013 02:34 AM

Some more cool git commands

Git Stash: Git stash allows you to stash any changes you have made to the working set so you can get back to a clean state. From here you could pull from the main repo to get up to date and then pull your stash back in

Code:

$ git stash
$ git stash list # view a list of whats on the stash
$ git stash apply # reapply the most recent stash

And another cool thing you can do is create a branch from the stash

Code:

$ git stash branch MyBranch
To push the branch to the remote repo

Code:

$ git push origin MyBranch
And to delete the remote branch

Code:

$ git push origin :MyBranch
$ git branch -d MyBranch # delete the branch locally as well


Disorder 02-21-2013 11:18 PM

where do you use these commands? Via cmd?

demonstar55 02-21-2013 11:31 PM

On Windows, in git bash if you have Git for Windows installed. Or on UNIX's just in the command line. Most of them have equivalent in Git GUI though.

Disorder 02-22-2013 12:39 AM

I see now, thank you. Do we use git to keep quests updated, etc? Also, How do we keep it from overwriting changed quests? Thanks.

c0ncrete 02-22-2013 12:50 AM

quests are still on svn

there is also a tortoisegit, which is somewhat like tortoisesvn

as for keeping your custom stuff from getting overwritten... you can tell both svn and git to ignore certain quests if you want. or you can keep your production quest directory separate from your download directory. that will allow you to check the files that have changed and apply them to your quest directory if you so choose.

Disorder 02-22-2013 12:54 AM

As always, thanks, c0ncrete.

Randymarsh9 01-04-2014 09:45 PM

I have a question about stashing things. If I want to update my source code, but I have made changes to a file that gets updated in the pull, it tells me to stash my changes first. If I were to stash my changes and the update the source, would it mess stuff up if I pulled in my old files? I'm not exactly sure how git works really, so I don't know if that's good practice. Will it merge them together or will it just overwrite the new files?

demonstar55 01-04-2014 10:10 PM

If you stash things, update, then pop them from the stash. I believe it just merges the changes, which if there are no merge conflicts, should be painless.


All times are GMT -4. The time now is 09:51 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.