This tutorial is meant to take you from being not at all familiar with Git to being functional. When you first encounter Git, it's overwhelming, daunting, and a little scary. This tutorial should help you get past that.
This tutorial is my first presentation done with RevealJS. It uses the Reveal Zoom plugin, which allows you to zoom in on elements with Alt+click (Ctrl+click on Linux). I also had to do some of my own hacking to allow you to zoom in with Ctrl++ and scroll on images.
Oh, and all images can be opened in another window or tab by clicking on them.
A repo starts out with a main branch: a set of files with a history of changes (ie: commits).
main branch.$ git checkout -b branchNamemain that won't include any of the unfinished code in your new feature.$ git checkout main$ git branch other_new_branch_namemain branch, including config files.origin remote.git pull or git rebase.$ git clone [git address]
There are two basic workflows when contributing to a project or repo:
The first is usually when you're part of a team that works on a project. No forking is necessary; just cloning and branching.
The second is usually when you're not part of the organization, but want to contribute anyway.
For these examples, assume the repo has already been cloned.
clone (because that was already done before when she first joined the org).pull before she gets started.origin so she has everything on her computer.At this point it's worth mentioning how your local repo works.
$ git add filename, or to add all at once: $ git add . (inlcuding the ".").$ git commit -m "Some notes about the commit here".$ git add .
$ git commit -m "Added a feature"
$ git push origin myNewFeature
Now GitHub has Jane's myNewFeature branch.
Create a Pull Request on GitHub and delete myNewFeature branch.
Note that myNewFeature branch still exists on Jane's local machine until she deletes it. ($ git branch -D myNewBranch)
fork to create his own copy of the repo on GitHub.Then he'll clone to get a copy of the repo on his own computer.
Now Joe pulls from the upstream remote (organization's repo) and pushes to the origin remote (Joe's copy on his GitHub account).
After pushing changes, Joe submits a Pull Request (PR) to have his changes added to the main repo.
git statusgit checkout [branch_name]$ git checkout myNewFeature puts you into the myNewFeature branch. Now all changes you make won't affect any other branch in your repo until you merge the changes into them.git pull [remote_name] [branch_name]$ git pull origin main pulls the main branch of the origin remote into your myNewFeature branch.git add .git commit -m "Commit notes go here"-a option to skip the previous step if there are no new files added.$ git commit -a -m "Fixed a typo identified in Issue #34"git push [remote_name] [branch_name][branch_name] doesn't exist on [remote_name], then one will be created.$ git push origin myNewFeature copies your changes in your myNewFeature branch to your repo on GitHub.