1. Fork the original code in github
Open https://github.com/lightningnetwork/lnd and while logged in, select the "Fork" option and follow any prompts.
2. Clone your fork to a local directory
Open terminal and type
git clone https://github.com/YOUR-USERNAME/lnd.git lnd-yourname
or if you have ssh keys setup for your git profile
git clone firstname.lastname@example.org:YOUR-USERNAME/lnd.git lnd-yourname
then change to the directory
3. Add the upstream, and sync your fork from it
If there have been commits since you cloned your fork, you will need to update from the master tree.
git remote add upstream git://github.com/lightningnetwork/lnd.git git fetch upstream
4. Updating your fork from original repo to keep up with their changes
git pull upstream master git rebase upstream/master
5. Make edits
Edit the various files in your desired editor. Save and exit.
6. Add the changes
To add a lot of files you can use
git add *
or just a single file
git add <filename-which-changed>
7. Add a commit message
git commit -m "this is an explanatory message"
7. updating your fork master
You will need to provide your github user/pass for this next step, or have ssh keys setup in your github account.
8. Make a pull request
Back in your browser, navigate to https://github.com/YOUR-USERNAME/lnd and select "Pull Request".
Github will check your fork against the original and highlight the changed files.
Proceed to add the PR and include a useful message.
9. Keeping your fork up to date
You can keep your fork up to date with
# Checkout your master branch and merge upstream git checkout master git rebase upstream/master
10. Keeping your history clean
Prior to submitting your pull request, you might want to do a few things to clean up your branch and make it as simple as possible for the original repo's maintainer to test, accept, and merge your work.
If any commits have been made to the upstream master branch, you should rebase your development branch so that merging it will be a simple fast-forward that won't require any conflict resolution work.
# Fetch upstream master and merge with your repo's master branch git fetch upstream git checkout master git merge upstream/master # If there were any new commits, rebase your development branch git checkout newfeature git rebase master
Now, it may be desirable to squash some of your smaller commits down into a small number of larger more cohesive commits. You can do this with an interactive rebase:
# Rebase all commits on your development branch git checkout git rebase -i master
This will open up a text editor where you can specify which commits to squash.