HomeArticlesContact

First Contributions

13 April 2021

First of all, thank you for your interest in free software and open source, and for contributing. Some things, down below, which would hopefully help you get started. Please feel free to ping me if you have any suggestions.

Making a Pull Request/Merge Request

Original Repo (for example): git.com/tor/support

  1. Fork the repo; you should have something like: git.com/<username>/support

  2. Clone your repo locally git clone https://git.com/<username>/support.git

  3. Creating a remote for the upstream repo (repo you forked from) git remote add upstream git.com/tor/support

  4. Create a branch you will be working on. git checkout -b <descriptive name for your branch>

4.1 You can check which branch you’re working on by running: git branch

  1. Make your changes now.

6.0 To see which files have been changed git status

  1. git add <files changed and now have to be added for commit> e.g git add README.md [can use git add --all to add all changed files]

  2. Commit your changes git commit -m <nice description of the changes made a.k.a commit message>

  3. Push your changes git push -u origin <descriptive name for your branch>

  4. You should see something like ‘Compare and Make a Pull Request’ on the GitHub interface.

Squashing Commits

Why?

By squashing, if there are multiple commits on a pull request they get consolidated into one.

Example

  1. Let’s make some quick changes to the README.md file in the repo. Three changes, three different commits:
$ echo "It's" >> README.md
$ git add README.md; git commit -m "first"
$ echo "Tor" >> README.md
$ git add README.md; git commit -m "second"
$ echo "not TOR. Pass it on. ;)" >> README.md
$ git add README.md; git commit -m "third"
  1. Contents of the README file
$ cat README.md
It's
Tor
not TOR. Pass it on. ;)
  1. The git log should show something like this:
$ git log
commit <commit-id 3> (HEAD -> master)
third

commit <commit-id 2>
second

commit <commit-id 1>
first
  1. Time to Squash!
    In this case, we want to turn the last 3 commits into one single commit. In git, HEAD is shorthand for “the last commit on this branch,” and we can use another shorthand HEAD~3 to indicate the last three commits from the head. We’ll use this syntax along with git rebase -i (short for interactive) to squash these commits
$ git rebase -i HEAD~3
  1. Something like this should open up in your $EDITOR of choice:
pick <commit-id 1> first
pick <commit-id 2> second
pick <commit-id 3> third

# Rebase <some commit-id> onto <some commit-id> (3 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# .       create a merge commit using the original merge commit's
# .       message (or the oneline, if no original merge commit was
# .       specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
#
# Note that empty commits are commented out
  1. Pick and Squash
pick <commit-id 1> first
squash <commit-id 2> second
squash <commit-id 3> third

# ...
  1. When you save this file and close it you’ll be prompted to write a new commit message for all three commits.
  2. And now if you run git log it should show you the last commit as a combination of all the three commits we squashed together!
  3. Force Push
    Since you’ve modified your git history, if you previously pushed to a branch for a PR then you’ll need to force push:
$ git push --force-with-lease origin <branchname>

NOTE: It is generally not recommended to use git push force since you run the risk of overriding other people’s work. Run --force-with-lease instead.

Getting started with Element (for IRC)

IRC is ephemeral. Unlike Slack & Discord there is no central logging mechanism, which most consider as a feature ;)
Albeit that also means you cannot see messages posted before you joined the channel, after you ‘left’ the channel or even if your IRC client got disconnected for some reason – yes, not even personal messages. Many folks use a IRC Bouncer like BNC and ZNC to maintain persistent connections to IRC but for which you need a server running 24/7. A more easier way is to use Element (previously known as Riot.im).

The steps to join the various IRC channels (or “rooms”) on various networks is basically the same as in: (1) https://support.torproject.org/get-in-touch/irc-help/; (2) https://support.torproject.org/get-in-touch/why-i-cant-join-tor-channels/, but there are a few things to point out:

  1. Make a account on Element.io.
  2. You should see a column named “Rooms” in the sidebar with a accompanying ‘+’ symbol. Well, click on it. You should be presented with a list of various networks, like - Freenode, OFTC, etc (by default it is ‘Matrix’). If you’re interested in joining the #tor- related channels, select OFTC from the list of networks.
  3. A OFTC IRC bridge window should pop up.
  4. Simply run /join #_oftc_#tor:matrix.org to join #tor on the OFTC Network. Done!
  5. But what if the channel only allows registered nicks? How to register and verify your IRC nick? Instead of running /msg NickServ run /msg @_oftc_NickServ:matrix.org, which should open a window with NickServ.
  6. Then you can run REGISTER yournewpassword youremailaddress, IDENTIFY YourPassWord, verify your account on OFTC’s website, then checkverify. See: https://support.torproject.org/get-in-touch/why-i-cant-join-tor-channels/