Um, Git What? [intro to the contemporary archive]
Artists and designers frequent archives, collections, libraries, museums, and the internet in search of source material to support research and studio practice. This project introduces GitHub, a very contemporary repository.
Git is an increasingly popular set of tools for people working with code. Because Git is referenced in new media cultures frequently and can be intimidating and alienating to those outside of software development communities this project is intended to help beginners gain some familiarity with what Git does, and how it can be used by artists and designers. Before digging into the Git exercises below please study the command-line as it is a convention for working with Git. [see UI Evolutions - for a command-line intro: http://www.arrayproject.com/content/ui-evolutions-intro-user-interface].
Git is a system for managing file revisions. When one person is working on a file [documents, designs, code files, etc] it is easy to manage the file history. An individual knows the file history, what revisions are made to the file, and knows when the file is saved. In contrast, when many people are collaborating simultaneously it is challenging to manage the situation because edits could be lost as each individual in the group opens, modifies, and saves. Git is intended to help manage these collaborative situations so no work is lost and no one involved in the project worries about tracking updates and avoiding conflicts. Git merges files, while keeping a complete record of what was changed, by who, and when changes are made [should reverting to an early version be necessary for example in the case of new errors or bugs]. Git is technically defined as a "distributed revision control and source code management (SCM) system." It is used to track files that are being modified [changed again and again and again!] by multiple people. Git [born 2005] was named by one if its creators, who claims the word has multiple meanings: British slang for despicable, mispronunciation of "get," or more formally "global information tracker."
GitHub is a hosting service. It is currently the largest and most popular web-based Git repository hosting service [there are others]. In addition to the command-line tool, GitHub now provides an optional web-based graphical interface tool for desktop as well as mobile integration [optional as many people still prefer to use the command-line]. Artists and designers can use GitHub to share projects in a repository of their own as well as "fork" [fork means copy] other repositories. Forking a repository allows artists and designers to freely and safely experiment with changes to other project files without affecting the original work. Forks might be used to access source files [to examine how something has been made], propose changes to someone else's project, or to use someone else's project as a starting point for a new idea.
Do you do contemporary research? Do you collaborate on any type of projects involving files? Do you write/share/practice code? Are you curious about Git technology and Github?
Use of Git is increasingly ubiquitous in code and design communities. It is a complex system for beginners. Git What? [intro to sharing files with git] exercises can be used to gain some initial familiarity with Git and some insight into how it can be used by artists and designers.
clone, commands, command-line, fork, git, github, knowledge workers, repository [or repo], shell, source code management, Terminal, version control
structure and timing
Individuals can follow the exercise prompts as the whole group steps through the process slowly. Expect to spend about 2+/- hours on Git. If the group is new to the command line, begin there and add another 1-2 hours getting familiar with Terminal.
01. Create a directory [aka a folder] called "myFirstGitRepo" on your Desktop.
02. Create two simple files to use during this exercise: lastname.txt and lastname.jpg. Save these files in "myFirstGitRepo."
03. Download and install the latest version of Git: http://git-scm.com/downloads. This will install Git on your computer. [There are other methods for installing Git but this download approach is a low pressure method for beginners.]
04. Launch Terminal.app. Check install with $ git --version. Then type the following commands at the prompt to configure your Git identity:
05. $ git config --global user.name First Last
06. $ git config --global user.email firstname.lastname@example.org
phase 1: initiate a working directory
This means activate git in a local directory [folder]; this is where you modify and edit your files locally.
07. $ pwd, $ cd Desktop
08. $ cd "myFirstGitRepo" then ls [reminder ls -a will reveal all files, even the invisible files! Try ls -a] [what do you see?]
09. $ cd ../Desktop [back up to Desktop]
10. $ git init myFirstGitRepo [alternative: generate a new directory with $ git init someNameHere]
11. $ ls -a again [now what do you see?]
At this point, nothing in your project directory is tracked yet. You must add files and commit files to start tracking changes.
phase 2: add files to staging area
A data staging area sits between the local directory and a permanent directory; this is where Git puts data "snapshots" of changes.
12. $ git status
13. $ git add lastname.txt [note: add multiple files by leaving a space between each] or $ git add . adds ALL content]; $ git add every time significant changes are made so a snapshot is stored
14. $ git status [note: pay attention to messages and suggestions]
15. now edit the contents of lastname.txt locally and save
16. $ git add lastname.txt
17. $ git status
18. $ git diff [note: shows file differences not yet staged] [type :q to exit this mode]
phase 3: commit files to the repository
A repository is a location in which data is stored and managed; this is where Git stores all the staged "snapshots" permanently. Every time you perform a commit, you are recording a snapshot of your project [review or revert any aspect of the project in the future].
19. $ git commit filename -m “detailed commit note about changes and updates goes here!”
20. $ git status
21. $ git log
note: If you leave off the -m option in the commit command, Git open an embedded command-line text editor called Vim for you to write a commit message. Type :q to leave Vim and do the commit again. Or type in your message at the top, hit escape, then type :wq
phase 4: GitHub / hunt and gather
GitHub.com is a hosting service, a space on the web where people can share projects [there are others]. GitHub.com is currently the largest and most popular web-based Git repository hosting service. Visit https://github.com, and create an account. The free account option is just fine. Once in make adjustments user settings.
Artists and designers can use GitHub to "fork" projects [fork means copy]. Forking a project allows artists and designers to freely and safely examine and experiment with project files without affecting the original work.
1. Search for terms/concepts that match your interest. Or see https://github.com/trending
2. Visit the project page and click the “Fork” button at the top-right of the page. After a few seconds, you’ll be taken to your new project page, with your own writeable copy of the code.
3. Copy the “HTTPS clone URL” text link at the bottom right. This is how you get a project to your local working space. Type the following into the command-line:
4. $ git clone https://github.com/yourAccountNameHere/nameOfCopiedRepo
5. $ cd nameOfCopiedRepo
optional collaboration [create a new topic branch of the project if the intention is to contribute back to the project]:
6. $ git checkout -b nameItSomethingUnique
optional collaboration [make code changes and commit them if the intention is to contribute back to the project]:
7. $ git commit -a -m 'message about the work that is changed'
optional collaboration [push that change back up to GitHub if the intention is to contribute back to the project]:
8. $ git push origin nameItSomethingUnique
GitHub will detect the new topic branch and prompt a “Pull Request” to the original project. This notifies the owner of the forked project that someone is suggesting a change. Activity on GitHub is public for the most part.
phase 5: GitHub / share [create your own repo]
Artists and designers can use GitHub to share projects in a repository. Click the “New repository” button on the right-hand side of the dashboard, or use the + button in the top toolbar next to your username. Provide a project name. Add Collaborators under settings if you are working with others who will be editing project source files directly.
scenario: GitHub first, Local second
01. make a new repo on GitHub [with a readme file]
02. in Terminal, get to your Desktop
03. $ git clone https://github.com/useraccountname/yourRepoName.git
04. $ cd yourRepoName
05. move all your working files into yourRepoName [include docs, code, graphics, etc]
06. $ ls -a
07. $ git status
08. $ git add .
09. $ git status
10. $ git commit [note: says "Your branch is ahead of 'origin/master' by 1 commit - the "origin/master" is the GitHub version, the clone is a "branch"]
11. $ git push origin master [look at your github.com repo and see your local directory merged with your online repo]
scenario: Local first, GitHub second
01. make a local directory on your Desktop, move all your working files into your Directory [include docs, code, graphics, etc]
02. $ cd
03. $ git init
04. $ ls -a
05. $ git add .
06. $ git commit -m 'First commit'
07. $ git status
08. now make a repo on GitHub
09. $ git remote add origin https://github.com/useraccountname/yourRepoName.git [assigning a new project origin]
10. $ git remote -v
11. $ git pull origin master [pull to make sure everything local is up to date with origin]
12. $ git push origin master [push your local content to GitHub]
If you’re working with other people who you want to give commit access to, you need to add them as “collaborators” in your GitHub project settings [making an organization is another option]. Doing so will give your group “push” access, which means they have both read and write access to the origin master repository. Remember in collaborative situations everyone is pushing to the origin, so everyone needs to "pull" regurally before "push" [to make sure assets are up to date locally]. In the rare case that you pull in code that has changes on the same line you have changed, git will give you a *merge conflict*. When this happens, you will need to open the file that has a merge conflict and manually choose which changes you want to be applied to the file.
When a project is hosted on GitHub, the URL can be given to anyone as a web page: https://github.com/<user>/<project_name>
There are many more involved Git commands for comparing, moving, reverting, undoing, and removing files; and Git is frequently used to organize and support different contexts, or branches [for a range of workflows]. Want more? check $ git help or visit https://git-scm.com/doc.
There are also many more involved processes and structures possible through GitHub. See: https://help.github.com
Contributor(s): Jessica Parris Westbrook, Adam Trowbridge
Updated date: 07/31/2015 - 20:26