Gittalk
- 10. Committing a change
patrick$ echo "Initial README" > README
patrick$ git add README
patrick$ git commit -m "Added README"
[master (root-commit) 5008efe] Added README
1 file changed, 1 insertion(+)
create mode 100644 README
- 12. What Happened?
patrick$ git log
commit 5008efe3eab3e746f1d54214566c6b3ed79d3656
Author: Patrick Tinsley <prtinsley@gmail.com>
Date: Thu Oct 25 21:31:17 2012 -0400
Added README
- 13. How Git Works
Working Directory
git add
Staging
git commit
Repository
- 17. Un-Staged Changes
patrick$ echo “I’m updating this again.” > README
patrick$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in
working directory)
#
# modified: README
#
no changes added to commit (use "git add" and/or "git commit -a")
- 20. Staged Changes
patrick$ git add .
patrick$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README
#
- 23. Reset
patrick$ git reset
Unstaged changes after reset:
M README
patrick$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working
directory)
#
# modified: README
#
no changes added to commit (use "git add" and/or "git commit -a")
- 33. How Do We Do It?
patrick$ git checkout -b new_feature
Switched to a new branch 'new_feature'
- 34. How Do We Do It?
patrick$ git checkout -b new_feature
Switched to a new branch 'new_feature'
patrick$ git branch
master
* new_feature
- 35. How Do We Do It?
patrick$ git checkout -b new_feature
Switched to a new branch 'new_feature'
patrick$ git branch
master
* new_feature
patrick$ git checkout master
Switched to branch 'master'
- 36. How Do We Do It?
patrick$ git checkout -b new_feature
Switched to a new branch 'new_feature'
patrick$ git branch
master
* new_feature
patrick$ git checkout master
Switched to branch 'master'
patrick$ git branch -d new_feature
Deleted branch new_feature (was
5008efe).
- 39. What About Merging?
patrick$ git checkout master
Switched to branch 'master'
patrick$ git merge update_readme
Updating 01ba47f..ee04cb3
Fast-forward
README | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
- 41. Conflict!
patrick$ git merge update_readme
Auto-merging README
CONFLICT (content): Merge conflict in README
Automatic merge failed; fix conflicts and then commit the result.
- 43. What Happened?
patrick$ git status
# On branch master
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark
resolution)
#
# both modified: README
#
no changes added to commit (use "git add" and/or "git commit -a")
- 49. Working With Github
Update your knowledge of Github (git fetch)
Update your local copy (git pull)
Push your code to Github (git push)
- 52. Example
example_app patrick$ git pull origin master
From github.com:prtinsley/example_app
* branch master -> FETCH_HEAD
Already up-to-date.
example_app patrick$ git push origin master
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 300 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
To git@github.com:prtinsley/first_app.git
261f716..8b66dca master -> master
- 54. Stashing
Cannot change branches with pending
changes
Save your work if not ready to commit
Apply pending changes to a different branch
Works like a stack
- 56. Example
patrick$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working
directory)
#
# modified: README
- 57. Example
patrick$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working
directory)
#
# modified: README
patrick$ git stash
Saved working directory and index state WIP on master: 92a5183
Updated README
HEAD is now at 92a5183 Updated README
- 60. Example
patrick$ git status
# On branch master
nothing to commit (working directory clean)
patrick$ git stash apply
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in
working directory)
#
# modified: README
#
- 61. Deployments
Code pulled from repository or build archive
Code not checked in will be overwritten
Soon all production servers will be IT access
only
- 63. GUI Clients
Tower
http://www.git-tower.com/
SourceTree
http://www.sourcetreeapp.com/
Github for Mac
http://mac.github.com/
Editor's Notes
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n