In order to participate, your environment should have:
gitis installed on your computer- A text editor (such as
atom) installed on your computer - A
githubaccount setup - You must know your password for
githuband youremail
Give your Github username to the TAs! Once you've been invited, we can get started.
If you didn't bring a computer, or are unfamiliar with terminal commands, make a friend
This talk will not cover, or expect, specific programming languages This talk will:
- Introduce a collaborative demo using git and Github
- Introduce vocabulary for using git and Github
- Understand a simple git workflow
- Talk about access control and Github
If you successfully finish workshop, you will
- be able to collaborate on simple projects using git and Github
- understand basic vocabulary for git
- know what to study next and where to find resources
- No more emailing document revisions
- Simpler local directory/file structures
- Remote storage
- Stable workflow
- Easily add new collaborators to project
- The world's most boring time machine
After I assign you an issue of content,
- add text contents of issue to the
README.mdfile - belonging to an existing repository
- in alphabetical order.
- Finally, use git to share your changes
A is for Amy who fell down the stairs
B is for Basil assaulted by bears
C is for Clara who wasted away
...
Z is for Zillah who drank to much gin
- Source and version control
- Ledger of work
- Collaboration tool
- Workflow management software
competes with : hg, svn, cvs
- Git service provider
- Account management and access control
- Hosting platform
- Ticket tracker / project management tool
competes with : GitLab, bitbucket, coding.net
- source code (any language)
- markdown / Jupyter / pdf
- small public (images & data-sets)
- PASSWORDS, access tokens, or private keys
- PHI, large images, large data-sets
- compiled binaries
- Non-pars-able documents (Word, Photoshop, ...)
- Working Copy - version of files I can currently edit
diff,status,log- What state am I in?checkout- swaps current working copy to specificcommit
remotelabels that alias another location (host)
-
init/clone- Starts a Project -
add/commitadd to ledger history - Tracks Changes -
fetch/mergeJoin multiple ledgers and handle merge conflicts -
push- Share Changes
$ git status
# On branch branch-b
...
# both modified:$ cat styleguide.md
If you have questions, please
email a contributor.$ cat styleguide.md
If you have a question, please open an issue on
github. If you have a solution, please submit
a pull request.
If you don't use the -m message flag, you will likely be subject to vim. vim can be a very frustrating file editor, if you don't bother to learn it.
Look into how to change your default EDITOR for your operating system.
To exit vim, Hit the Esc key to enter "Command mode". Then you can type : to enter "Command-line mode". A colon (:) will appear at the bottom of the screen and you can type in one of the following commands. To execute a command, press the Enter key.
:qto quit (short for:quit):q!to quit without saving (short for:quit!):wqto write andquit
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com- 10 people per repository team {red, blue, black}
- Each panel represents one entry from poem
- Split panel text lines with <= 80 characters
- Panels ordered alphabetically (by second word)
- Your team is done when all panels added
- Do a
diffagainstorigin/masterbefore amerge - Review the
logat least once (qto quit)
status,diff,logclone,initfetch,merge,commit,push,fetch
$ git clone https://github.com/PortlandDataScienceGroup/ABC.git
Cloning into 'ABC'...
remote: Counting objects: 500, done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 500 (delta 27), reused 33 (delta 12), pack-reused 451
Receiving objects: 100% (500/500), 6.72 MiB | 1.71 MiB/s, done.
Resolving deltas: 100% (286/286), done.
Checking connectivity... done.
$- Complete the Game
- Signal TAs for help if you get stuck!
Can specify file types or specific files to not commit
Each line is a file type or filename
- can use wildcard patterns:
.csv - don't save my
secrets.json
*.csv
secrets.json
$ cat secrets.json # this file should not be committed
{
"password":"MySuperNeatoPassword!#"
}import json
# this file should be committed
with open('secrets.json') as fd:
pwd = json.load(fd)['password']
print(pwd)- Code reviews
- Create / destroy user and organization accounts
- Access control
- Create / destroy repository
- Issue creation / assignment / management
- Gists
Collaboration within a team is different than from outside, as a consequence of access control.
fork- Copies repositorypull request- Shares changes back to source
forkrepository on Githubcloneforked repository to local directoryadd upstreamdirected toward original repository- Edit files, save,
commit, thenpushchanges in forked repository pull requestagainst original repository
Branching allows
- encapsulation of features
- simple
diffs between features - easier
pull requests
- Look for a
CONTRIBUTORS.mdfile - Look for style guides
- Read documentation before collaborating
- Take code review feedback seriously and not personally
- Identify an appropriate
issuefor your skill level rebase -ito encapsulate solution to singleissue
checkout- use another version as working copybranch- encapsulate workrebase/rebase -i- edit branch history- Learn about branching models
- Learn about version numbers



