Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Submitting patches for MUSHclient using Git

Submitting patches for MUSHclient using Git

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Sat 23 Jan 2010 02:00 AM (UTC)

Amended on Sat 23 Jan 2010 02:02 AM (UTC) by Nick Gammon

Message
This shows an example of submitting patches to MUSHclient using Git.

First, install git. ;)

Then, get a copy of the MUSHclient source, like this:


$ git clone git://github.com/nickgammon/mushclient.git


If you already have MUSHclient from git, make sure you have the latest version, like this:


$ git pull     # from the mushclient directory


Change to the MUSHclient directory, and make a branch for your changes:


$ cd mushclient
$ git checkout -b my_extra_stuff

Switched to a new branch "my_extra_stuff"


Edit the code. In my case I added a line in doc.cpp, line 724, as follows:


  Note (Translate ("MUSHclient - FreeWare MUD client."));


See what changes you made:


$ git status

# On branch my_extra_stuff
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   doc.cpp
#
no changes added to commit (use "git add" and/or "git commit -a")


Compile and test that things are working how you expect.

Then, add and commit the changes:


$ git commit -am "Added extra welcome message"

Created commit d3a7ec4: Added extra welcome message
 1 files changed, 1 insertions(+), 0 deletions(-)


Make a patch file:


$ git format-patch master --stdout > my_great_patch.diff


Check out the patch:


$ cat my_great_patch.diff

From d3a7ec4c1888a5f46c77d6eb082de3b1eedab94a Mon Sep 17 00:00:00 2001
From: Nick Gammon <nick@gammon.com.au>
Date: Sat, 23 Jan 2010 13:52:20 +1100
Subject: [PATCH] Added extra welcome message

---
 doc.cpp |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/doc.cpp b/doc.cpp
index 2ebe00e..228543d 100644
--- a/doc.cpp
+++ b/doc.cpp
@@ -721,6 +721,7 @@ void CMUSHclientDoc::SetUpOutputWindow (void)
     }

   Note ("");
+  Note (Translate ("MUSHclient - FreeWare MUD client."));
   Note (TFormat ("Welcome to MUSHclient version %s!", MUSHCLIENT_VERSION));
   Note (Translate ("Written by Nick Gammon."));
   Note ("");
--
1.5.6.3



The patch can now be emailed to me, or posted in the forum.

Template:codetag To make your code more readable please use [code] tags as described here.


If posting in the forum, make sure you "escape forum codes" as well as using the 'code' tag as described in the link above.

If I choose to accept the patch, I can use "git am" to "apply mail message" which would merge the patch into the latest version.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Sat 23 Jan 2010 02:28 AM (UTC)

Amended on Sat 23 Jan 2010 02:36 AM (UTC) by Twisol

Message
Another, possibly easier method is to use GitHub's inbuilt fork support. You have to install git, as well as have a public repository of your own somewhere (and I'll explain how to fork using GitHub in particular).

There are a few guides you might want to read beforehand, or in addition to this one:

(EDIT: Actually, this one guide gets you started really well, so you might want to see this one first if you're a github newbie. It assumes msysgit, but it's still largely relevant for Cygwin's git too: http://github.com/guides/using-git-and-github-for-the-windows-for-newbies)

Tutorials on general git usage: http://learn.github.com/
Setting up an SSH key so you can push to your GitHub repository: http://help.github.com/msysgit-key-setup/
Configuring git: http://help.github.com/msysgit-key-setup/
Forking with GitHub: http://help.github.com/forking/

Pretty much everything at http://help.github.com/ and http://github.com/guides/home will be useful. Also, note that this is just a simple overview of collaborating with GitHub; it assumes you have at least a working knowledge of git itself, and preferrably have your GitHub account set up (which the above links should help with).


1. Go to http://github.com/nickgammon/mushclient, and click "Fork" near the upper-right side of the page (below the search bar).

2. Run the following commands from the console/terminal (taken from GitHub's help article on the topic) to clone your forked GitHub repository to your computer, and set up a 'remote' so you can easily push your changes to your GitHub fork later. Make sure that you're in the directory you want the repository folder to go into, i.e. if you want the directory to be in Documents\mushclient\, you should be in the Documents\ folder.

git clone git@github.com:<Your GitHub username here>/mushclient.git

cd mushclient

git remote add origin git://github.com/<Your GitHub username here>/github-services.git

git fetch origin


3. Edit the source, do what you want, etc etc. 'git diff' is a great command to use to see what you've changed exactly, and 'git status' shows which files have been modified/added/removed.

5. When you're ready to make your changes public, make sure you've committed your changes, and use 'git push origin master'. You'll probably need to enter your GitHub password at this point.

6. Once you're ready for Nick to look over your changes, click "Pull request" on your forked GitHub repository and fill out the form.



If in doubt, consult the tutorials/documentation. I'm definitely not a GitHub expert. ;)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


8,383 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.