git for beginners
DESCRIPTION
The basics of Git repository interaction (git add, git commit, git log) and collaboration (git remote, git push, git pull).TRANSCRIPT
Git for BeginnersNew England Drupal Camp
November 1, 2014Rick Umali@rickumali
http://tech.rickumali.com/
Slides!
Me and You● Me
○ VIC-20○ Boston○ Data Janitor○ Git
● You?
Book!
Nov 1, 2014: drupalcftw (44% off) thru November 2014
One Day Special: Nov 2, 2014: dotd110214au (50% off)
44%
Off!
http://www.manning.com/umali
Version Control
Version Control
GitGit is an open source, distributed version control system designed for speed and efficiency.
FreedomNo “server” requiredUnique architecture
What We Will Do
Step 1. Create Repo% cd sites/all/modules
% mkdir dumpstamp
% cd dumpstamp
% git init
Git is a circle
Step 2. Add Code% vi README.txt
% git add README.txt
% git commit -m “First commit.”
Two step process: add then commit
Step 3. Review% git log% gitk% git status
Repeat 2 and 3% vi dumpstamp.info dumpstamp.module
% git status
% git add .
% git status
% git commit (or git citool)
% git diff
Tagging a Version% git tag -a v1.0
% git tag -l -n% git show v1.0
v1.0
annotated
Bookmarks
Repeat 2 and 3% vi dumpstamp.module
% git status
% git add .
% git status
% git diff
% git commit
v1.0
Go Back in Time% git checkout v1.0% git checkout master
v1.0
Detached HEAD
Fork in the Road (Branch)% git checkout -b time_stamp v1.0
OR
% git checkout v1.0% git branch time_stamp% git checkout time_stamp v1.0
We’ve been working on a branch all along!
Add Code to New Branch% git branch
% vi dumpstamp.module
% git status
% git diff
% git commit -av1.0
Separate lines of code/development
Everything we’ve done so far was local…
Let’s now bring others in our work
Collaborating
you
bob
mary
Collaborating via GitHub
bob
maryGitHub
you1
2
3
Creating a Repo on GitHubhttps://help.github.com/articles/create-a-repo/
Initial Push to GitHub% git remote add origin \
[email protected]:rickumali/REPO.git
% git push -u origin --all
% git push --tags
you GitHub
Clone and Pull% git clone \
[email protected]:rickumali/REPO.git
% cd mary
% git branch --all
maryGitHub
Git is a circle
Collaborating via GitHub
mary
GitHub
you git pushgit pull git push
git pull
Thank You!
Rick Umali@rickumali
http://tech.rickumali.com/
Git for Beginners
Homework: Merging% git checkout master
% git merge time_stamp
v1.0