ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Tower ¨C the most powerful Git client for Mac
the most powerful Git client for Mac
Create
Clone an existing repository	
$gitclonessh://user@domain.com/repo.git
Create a new local repository 	
$ git init
local Changes
Changed files in your working directory
$ git status
Changes to tracked files 	
$ git diff
Add all current changes to the next
commit
$ git add .
Add some changes in file to the next
commit
$ git add -p file
Commit all local changes in tracked files
$ git commit -a
Commit previously staged changes
$ git commit
Change the last commit
Don¡®t amend published commits!
$ git commit --amend	
Commit History
Show all commits, starting with newest
$ git log
Show changes over time for a specific file
$ git log -p file
Who changed what and when in file
$ git blame file
Branches  Tags
List all existing branches
$ git branch
Switch HEAD branch
$ git checkout branch
Create a new branch based on your
current HEAD
$ git branch new-branch
Create a new tracking branch based on
a remote branch
$ git branch --track new-branch
remote-branch
Delete a local branch
$ git branch -d branch
Mark the current commit with a tag
$ git tag tag-name
Update  Publish
List all currently configured remotes
$ git remote -v
Show information about a remote
$ git remote show remote
Add new remote repository, named
remote 
$ git remote add remote url
Download all changes from remote,
but don¡®t integrate into HEAD
$ git fetch remote
Download changes and directly merge/
integrate into HEAD
$ git pull remote branch
Publish local changes on a remote
$ git push remote branch
Delete a branch on the remote
$ git push remote :branch
Publish your tags
$ git push --tags
Merge  Rebase
Merge branch into your current HEAD
$ git merge branch
Rebase your current HEAD onto branch
Don¡®t rebase published commits!
$ git rebase branch
Abort a rebase
$ git rebase --abort
Continue a rebase after resolving conflicts
$ git rebase --continue
Use your configured merge tool to
solve conflicts
$ git mergetool
Use your editor to manually solve con-
flicts and (after resolving) mark file as
resolved
$ git add resolved-file
$ git rm resolved-file
Undo
Discard all local changes in your working
directory	
$ git reset --hard HEAD
Discard local changes in a specific file
$ git checkout HEAD file
Revert a commit (by producing a new
commit with contrary changes)
$ git revert commit
Reset your HEAD pointer to a previous
commit
¡­and discard all changes since then
$ git reset --hard commit
¡­and preserve all changes as unstaged
changes
$ git reset commit
¡­and preserve uncommitted local
changes
$ git reset --keep commit
30-day free trial available at
www.git-tower.com
git cheat sheet
presented by
fournova
Commit Related Changes
A commit should be a wrapper for related
changes. For example, fixing two diffe-
rent bugs should produce two separate
commits. Small commits make it easier
for other developers to understand the
changes and roll them back if something
went wrong.
With tools like the staging area and the
ability to stage only parts of a file, Git
makes it easy to create very granular
commits.
Commit Often
Committing often keeps your commits
small and, again, helps you commit only
related changes. Moreover, it allows you
to share your code more frequently with
others. That way it¡®s easier for everyone
to integrate changes regularly and avoid
having merge conflicts. Having few large
commits and sharing them rarely, in con-
trast, makes it hard to solve conflicts.
Don¡®t Commit Half-Done Work
You should only commit code when
it¡®s completed. This doesn¡®t mean you
have to complete a whole, large feature
before committing. Quite the contrary:
split the feature¡®s implementation into
logical chunks and remember to commit
early and often. But don¡®t commit just to
have something in the repository before
leaving the office at the end of the day. If
you¡®re tempted to commit just because
you need a clean working copy (to check
out a branch, pull in changes, etc.) consi-
der using Git¡®s ?Stash? feature instead.
Test Code Before You Commit
Resist the temptation to commit some-
thing that you ?think? is completed. Test
it thoroughly to make sure it really is
completed and has no side effects (as far
as one can tell). While committing half-
baked things in your local repository only
requires you to forgive yourself, having
your code tested is even more important
when it comes to pushing/sharing your
code with others.
Write Good Commit Messages
Begin your message with a short sum-
mary of your changes (up to 50 charac-
ters as a guideline). Separate it from
the following body by including a blank
line. The body of your message should
provide detailed answers to the following
questions:
¨C What was the motivation for the change?
¨C How does it differ from the previous
implementation?
Use the imperative, present tense
(?change?, not ?changed? or ?changes?)
to be consistent with generated messa-
ges from commands like git merge.
Version Control is not
a Backup System
Having your files backed up on a remote
server is a nice side effect of having a
version control system. But you should
not use your VCS like it was a backup
system. When doing version control, you
should pay attention to committing se-
mantically (see ?related changes?) - you
shouldn¡®t just cram in files.
Use Branches
Branching is one of Git¡®s most powerful
features - and this is not by accident:
quick and easy branching was a central
requirement from day one. Branches are
the perfect tool to help you avoid mixing
up different lines of development. You
should use branches extensively in your
development workflows: for new fea-
tures, bug fixes, ideas¡­
Agree on a Workflow
Git lets you pick from a lot of different
workflows: long-running branches, topic
branches, merge or rebase, git-flow¡­
Which one you choose depends on a
couple of factors: your project, your
overall development and deployment
workflows and (maybe most important-
ly) on your and your teammates¡® personal
preferences. However you choose to
work, just make sure to agree on a com-
mon workflow that everyone follows.
Help  Documentation
Get help on the command line
$ git help command
Official Git Website
http://www.git-scm.com/
Free online resources
http://progit.org
http://book.git-scm.org
http://gitref.org
fournova
best practices
version control
the most powerful Git client for Mac
30-day free trial available at
www.git-tower.com

More Related Content

What's hot (15)

GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
Nyros Technologies
?
Introduction to Git (part 2)
Introduction to Git (part 2)Introduction to Git (part 2)
Introduction to Git (part 2)
Salvatore Cordiano
?
Git Pull Requests
Git Pull RequestsGit Pull Requests
Git Pull Requests
Callon Campbell
?
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
Dilum Navanjana
?
Recovering From Git Mistakes - Nina Zakharenko
Recovering From Git Mistakes - Nina ZakharenkoRecovering From Git Mistakes - Nina Zakharenko
Recovering From Git Mistakes - Nina Zakharenko
Nina Zakharenko
?
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
Nyros Technologies
?
Intro to Gitflow
Intro to GitflowIntro to Gitflow
Intro to Gitflow
Ben Speakmon
?
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
Gourav Varma
?
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
DSCVSSUT
?
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
?
Mastering GIT
Mastering GITMastering GIT
Mastering GIT
Hasnaeen Rahman
?
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Rick Umali
?
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
Pablo Quiroga
?
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
Bartosz Kosarzycki
?
GitHub Talk - Cody Carnachan
GitHub Talk - Cody CarnachanGitHub Talk - Cody Carnachan
GitHub Talk - Cody Carnachan
Cody Carnachan
?
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
Dilum Navanjana
?
Recovering From Git Mistakes - Nina Zakharenko
Recovering From Git Mistakes - Nina ZakharenkoRecovering From Git Mistakes - Nina Zakharenko
Recovering From Git Mistakes - Nina Zakharenko
Nina Zakharenko
?
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
Gourav Varma
?
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
DSCVSSUT
?
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
?
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Rick Umali
?
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
Bartosz Kosarzycki
?
GitHub Talk - Cody Carnachan
GitHub Talk - Cody CarnachanGitHub Talk - Cody Carnachan
GitHub Talk - Cody Carnachan
Cody Carnachan
?

Viewers also liked (20)

 ciencias politicas ciencias politicas
ciencias politicas
Angie Herrera
?
Guia Seguridad MenoresGuia Seguridad Menores
Guia Seguridad Menores
Fapace Almer¨ªa
?
Auditoria contableAuditoria contable
Auditoria contable
yulitza123
?
Reunio12 13
Reunio12 13Reunio12 13
Reunio12 13
education
?
Els animals vertebrats
Els animals vertebratsEls animals vertebrats
Els animals vertebrats
Gemma
?
Hspice tut
Hspice tutHspice tut
Hspice tut
Peter Pro
?
Festa apadrinament
Festa apadrinamentFesta apadrinament
Festa apadrinament
reixac2010
?
VIMѧϰ±Ê¼Ç8 Ñ¡Ôñģʽ
VIMѧϰ±Ê¼Ç8 Ñ¡ÔñģʽVIMѧϰ±Ê¼Ç8 Ñ¡Ôñģʽ
VIMѧϰ±Ê¼Ç8 Ñ¡Ôñģʽ
King Hom
?
EDUCACION FISICA, PROYECTOS Y B LEARNINGEDUCACION FISICA, PROYECTOS Y B LEARNING
EDUCACION FISICA, PROYECTOS Y B LEARNING
Mary Jo Guerrero
?
The Power of 2D Stacked Charts in Business Communication
The Power of 2D Stacked Charts in Business CommunicationThe Power of 2D Stacked Charts in Business Communication
The Power of 2D Stacked Charts in Business Communication
Cerebel Consulting
?
Wimax
WimaxWimax
Wimax
yogi123maurya
?
Trabajo fisica 2Trabajo fisica 2
Trabajo fisica 2
Stephanie
?
Linux ÐÂÊÖÈëÃÅ
Linux ÐÂÊÖÈëÃÅLinux ÐÂÊÖÈëÃÅ
Linux ÐÂÊÖÈëÃÅ
King Hom
?
Presentacio aguila peixetra
Presentacio aguila peixetraPresentacio aguila peixetra
Presentacio aguila peixetra
education
?
Exploration research form
Exploration   research formExploration   research form
Exploration research form
Aaron Maurer
?
precentacionesprecentaciones
precentaciones
crisloyola
?
 ciencias politicas ciencias politicas
ciencias politicas
Angie Herrera
?
Guia Seguridad MenoresGuia Seguridad Menores
Guia Seguridad Menores
Fapace Almer¨ªa
?
Auditoria contableAuditoria contable
Auditoria contable
yulitza123
?
Els animals vertebrats
Els animals vertebratsEls animals vertebrats
Els animals vertebrats
Gemma
?
Festa apadrinament
Festa apadrinamentFesta apadrinament
Festa apadrinament
reixac2010
?
VIMѧϰ±Ê¼Ç8 Ñ¡Ôñģʽ
VIMѧϰ±Ê¼Ç8 Ñ¡ÔñģʽVIMѧϰ±Ê¼Ç8 Ñ¡Ôñģʽ
VIMѧϰ±Ê¼Ç8 Ñ¡Ôñģʽ
King Hom
?
EDUCACION FISICA, PROYECTOS Y B LEARNINGEDUCACION FISICA, PROYECTOS Y B LEARNING
EDUCACION FISICA, PROYECTOS Y B LEARNING
Mary Jo Guerrero
?
The Power of 2D Stacked Charts in Business Communication
The Power of 2D Stacked Charts in Business CommunicationThe Power of 2D Stacked Charts in Business Communication
The Power of 2D Stacked Charts in Business Communication
Cerebel Consulting
?
Trabajo fisica 2Trabajo fisica 2
Trabajo fisica 2
Stephanie
?
Linux ÐÂÊÖÈëÃÅ
Linux ÐÂÊÖÈëÃÅLinux ÐÂÊÖÈëÃÅ
Linux ÐÂÊÖÈëÃÅ
King Hom
?
Presentacio aguila peixetra
Presentacio aguila peixetraPresentacio aguila peixetra
Presentacio aguila peixetra
education
?
Exploration research form
Exploration   research formExploration   research form
Exploration research form
Aaron Maurer
?
precentacionesprecentaciones
precentaciones
crisloyola
?

Similar to Git cheat sheet__white (20)

Git basic introduction & tutorial for begginer
Git basic introduction & tutorial for begginerGit basic introduction & tutorial for begginer
Git basic introduction & tutorial for begginer
AnDiLestiAnto2
?
Git basics
Git basicsGit basics
Git basics
GHARSALLAH Mohamed
?
Git github
Git githubGit github
Git github
Anurag Deb
?
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
?
Git and Github
Git and GithubGit and Github
Git and Github
Teodora Ahkozidou
?
Git and github
Git and githubGit and github
Git and github
Teodora Ahkozidou
?
Git 101
Git 101Git 101
Git 101
jayrparro
?
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
?
SVN 2 Git
SVN 2 GitSVN 2 Git
SVN 2 Git
Marco De Stefano
?
Git - Version Control System
Git - Version Control SystemGit - Version Control System
Git - Version Control System
Namig Hajiyev
?
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
John Stevenson
?
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
?
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
?
Git slides
Git slidesGit slides
Git slides
Nanyak S
?
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
Prakash Dantuluri
?
Git
GitGit
Git
Gayan Kalanamith Mannapperuma
?
git2.ppt
git2.pptgit2.ppt
git2.ppt
ssusered2ec2
?
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
Piyush Mittal
?
Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer Cheatsheet
Abdul Basit
?
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystem
Fran?ois D'Agostini
?

More from King Hom (20)

Perl.predefined.variables
Perl.predefined.variablesPerl.predefined.variables
Perl.predefined.variables
King Hom
?
Gnu coreutils-cheat-sheet
Gnu coreutils-cheat-sheetGnu coreutils-cheat-sheet
Gnu coreutils-cheat-sheet
King Hom
?
Git cheat sheet_dark
Git cheat sheet_darkGit cheat sheet_dark
Git cheat sheet_dark
King Hom
?
Git cheat sheet__grey
Git cheat sheet__greyGit cheat sheet__grey
Git cheat sheet__grey
King Hom
?
Firefox cheat sheet
Firefox cheat sheetFirefox cheat sheet
Firefox cheat sheet
King Hom
?
Chrome sheet
Chrome sheetChrome sheet
Chrome sheet
King Hom
?
Vim ʵÓü¼Êõ£¬µÚ 1 ²¿·Ö: ʵÓü¼ÇÉ
Vim ʵÓü¼Êõ£¬µÚ 1 ²¿·Ö: ʵÓü¼ÇÉVim ʵÓü¼Êõ£¬µÚ 1 ²¿·Ö: ʵÓü¼ÇÉ
Vim ʵÓü¼Êõ£¬µÚ 1 ²¿·Ö: ʵÓü¼ÇÉ
King Hom
?
ÈËÌå24СʱÆ÷¹Ù¹¤×÷±í
ÈËÌå24СʱÆ÷¹Ù¹¤×÷±íÈËÌå24СʱÆ÷¹Ù¹¤×÷±í
ÈËÌå24СʱÆ÷¹Ù¹¤×÷±í
King Hom
?
ÊÖ°ÑÊÖ½ÌÄã°Ñ³Õ¾±³¾¸Ä×°³ÉÒ»¸ö±õ¶Ù·¡±à³Ì»·¾³(ͼÎÄ)
ÊÖ°ÑÊÖ½ÌÄã°Ñ³Õ¾±³¾¸Ä×°³ÉÒ»¸ö±õ¶Ù·¡±à³Ì»·¾³(ͼÎÄ)ÊÖ°ÑÊÖ½ÌÄã°Ñ³Õ¾±³¾¸Ä×°³ÉÒ»¸ö±õ¶Ù·¡±à³Ì»·¾³(ͼÎÄ)
ÊÖ°ÑÊÖ½ÌÄã°Ñ³Õ¾±³¾¸Ä×°³ÉÒ»¸ö±õ¶Ù·¡±à³Ì»·¾³(ͼÎÄ)
King Hom
?
VIMѧϰ±Ê¼Ç2 Òƶ¯ºÍÐÞ¸ÄÃüÁî
VIMѧϰ±Ê¼Ç2 Òƶ¯ºÍÐÞ¸ÄÃüÁîVIMѧϰ±Ê¼Ç2 Òƶ¯ºÍÐÞ¸ÄÃüÁî
VIMѧϰ±Ê¼Ç2 Òƶ¯ºÍÐÞ¸ÄÃüÁî
King Hom
?
VIMѧϰ±Ê¼Ç3 ¸´ÖƺÍÕ³ÌùÃüÁî
VIMѧϰ±Ê¼Ç3 ¸´ÖƺÍÕ³ÌùÃüÁîVIMѧϰ±Ê¼Ç3 ¸´ÖƺÍÕ³ÌùÃüÁî
VIMѧϰ±Ê¼Ç3 ¸´ÖƺÍÕ³ÌùÃüÁî
King Hom
?
VIMѧϰ±Ê¼Ç6 ʹÓöà±êÇ©Ò³
VIMѧϰ±Ê¼Ç6 ʹÓöà±êÇ©Ò³VIMѧϰ±Ê¼Ç6 ʹÓöà±êÇ©Ò³
VIMѧϰ±Ê¼Ç6 ʹÓöà±êÇ©Ò³
King Hom
?
°²×° Subversion
°²×° Subversion°²×° Subversion
°²×° Subversion
King Hom
?
Effective_Vim
Effective_VimEffective_Vim
Effective_Vim
King Hom
?
VIMѧϰ±Ê¼Ç1 »ù±¾±à¼­ÃüÁî
VIMѧϰ±Ê¼Ç1 »ù±¾±à¼­ÃüÁîVIMѧϰ±Ê¼Ç1 »ù±¾±à¼­ÃüÁî
VIMѧϰ±Ê¼Ç1 »ù±¾±à¼­ÃüÁî
King Hom
?
VIMѧϰ±Ê¼Ç4 ²éÕÒÎı¾
VIMѧϰ±Ê¼Ç4 ²éÕÒÎı¾VIMѧϰ±Ê¼Ç4 ²éÕÒÎı¾
VIMѧϰ±Ê¼Ç4 ²éÕÒÎı¾
King Hom
?
VIMѧϰ±Ê¼Ç7 ¿ÉÊÓ»¯Ä£Ê½
VIMѧϰ±Ê¼Ç7 ¿ÉÊÓ»¯Ä£Ê½VIMѧϰ±Ê¼Ç7 ¿ÉÊÓ»¯Ä£Ê½
VIMѧϰ±Ê¼Ç7 ¿ÉÊÓ»¯Ä£Ê½
King Hom
?
±¹¾±³¾Óû§ÊÖ²áÖÐÎÄ°æ
±¹¾±³¾Óû§ÊÖ²áÖÐÎÄ°æ±¹¾±³¾Óû§ÊÖ²áÖÐÎÄ°æ
±¹¾±³¾Óû§ÊÖ²áÖÐÎÄ°æ
King Hom
?
¸ßЧÂʱ༭Æ÷ VIM£­²Ù×÷ƪ
¸ßЧÂʱ༭Æ÷ VIM£­²Ù×÷ƪ¸ßЧÂʱ༭Æ÷ VIM£­²Ù×÷ƪ
¸ßЧÂʱ༭Æ÷ VIM£­²Ù×÷ƪ
King Hom
?
ÉèÖÃÓñ¹¾±³¾±à¼­±è²â³Ù³ó´Ç²Ô
ÉèÖÃÓñ¹¾±³¾±à¼­±è²â³Ù³ó´Ç²ÔÉèÖÃÓñ¹¾±³¾±à¼­±è²â³Ù³ó´Ç²Ô
ÉèÖÃÓñ¹¾±³¾±à¼­±è²â³Ù³ó´Ç²Ô
King Hom
?
Perl.predefined.variables
Perl.predefined.variablesPerl.predefined.variables
Perl.predefined.variables
King Hom
?
Gnu coreutils-cheat-sheet
Gnu coreutils-cheat-sheetGnu coreutils-cheat-sheet
Gnu coreutils-cheat-sheet
King Hom
?
Git cheat sheet_dark
Git cheat sheet_darkGit cheat sheet_dark
Git cheat sheet_dark
King Hom
?
Git cheat sheet__grey
Git cheat sheet__greyGit cheat sheet__grey
Git cheat sheet__grey
King Hom
?
Firefox cheat sheet
Firefox cheat sheetFirefox cheat sheet
Firefox cheat sheet
King Hom
?
Vim ʵÓü¼Êõ£¬µÚ 1 ²¿·Ö: ʵÓü¼ÇÉ
Vim ʵÓü¼Êõ£¬µÚ 1 ²¿·Ö: ʵÓü¼ÇÉVim ʵÓü¼Êõ£¬µÚ 1 ²¿·Ö: ʵÓü¼ÇÉ
Vim ʵÓü¼Êõ£¬µÚ 1 ²¿·Ö: ʵÓü¼ÇÉ
King Hom
?
ÈËÌå24СʱÆ÷¹Ù¹¤×÷±í
ÈËÌå24СʱÆ÷¹Ù¹¤×÷±íÈËÌå24СʱÆ÷¹Ù¹¤×÷±í
ÈËÌå24СʱÆ÷¹Ù¹¤×÷±í
King Hom
?
ÊÖ°ÑÊÖ½ÌÄã°Ñ³Õ¾±³¾¸Ä×°³ÉÒ»¸ö±õ¶Ù·¡±à³Ì»·¾³(ͼÎÄ)
ÊÖ°ÑÊÖ½ÌÄã°Ñ³Õ¾±³¾¸Ä×°³ÉÒ»¸ö±õ¶Ù·¡±à³Ì»·¾³(ͼÎÄ)ÊÖ°ÑÊÖ½ÌÄã°Ñ³Õ¾±³¾¸Ä×°³ÉÒ»¸ö±õ¶Ù·¡±à³Ì»·¾³(ͼÎÄ)
ÊÖ°ÑÊÖ½ÌÄã°Ñ³Õ¾±³¾¸Ä×°³ÉÒ»¸ö±õ¶Ù·¡±à³Ì»·¾³(ͼÎÄ)
King Hom
?
VIMѧϰ±Ê¼Ç2 Òƶ¯ºÍÐÞ¸ÄÃüÁî
VIMѧϰ±Ê¼Ç2 Òƶ¯ºÍÐÞ¸ÄÃüÁîVIMѧϰ±Ê¼Ç2 Òƶ¯ºÍÐÞ¸ÄÃüÁî
VIMѧϰ±Ê¼Ç2 Òƶ¯ºÍÐÞ¸ÄÃüÁî
King Hom
?
VIMѧϰ±Ê¼Ç3 ¸´ÖƺÍÕ³ÌùÃüÁî
VIMѧϰ±Ê¼Ç3 ¸´ÖƺÍÕ³ÌùÃüÁîVIMѧϰ±Ê¼Ç3 ¸´ÖƺÍÕ³ÌùÃüÁî
VIMѧϰ±Ê¼Ç3 ¸´ÖƺÍÕ³ÌùÃüÁî
King Hom
?
VIMѧϰ±Ê¼Ç6 ʹÓöà±êÇ©Ò³
VIMѧϰ±Ê¼Ç6 ʹÓöà±êÇ©Ò³VIMѧϰ±Ê¼Ç6 ʹÓöà±êÇ©Ò³
VIMѧϰ±Ê¼Ç6 ʹÓöà±êÇ©Ò³
King Hom
?
°²×° Subversion
°²×° Subversion°²×° Subversion
°²×° Subversion
King Hom
?
Effective_Vim
Effective_VimEffective_Vim
Effective_Vim
King Hom
?
VIMѧϰ±Ê¼Ç1 »ù±¾±à¼­ÃüÁî
VIMѧϰ±Ê¼Ç1 »ù±¾±à¼­ÃüÁîVIMѧϰ±Ê¼Ç1 »ù±¾±à¼­ÃüÁî
VIMѧϰ±Ê¼Ç1 »ù±¾±à¼­ÃüÁî
King Hom
?
VIMѧϰ±Ê¼Ç4 ²éÕÒÎı¾
VIMѧϰ±Ê¼Ç4 ²éÕÒÎı¾VIMѧϰ±Ê¼Ç4 ²éÕÒÎı¾
VIMѧϰ±Ê¼Ç4 ²éÕÒÎı¾
King Hom
?
VIMѧϰ±Ê¼Ç7 ¿ÉÊÓ»¯Ä£Ê½
VIMѧϰ±Ê¼Ç7 ¿ÉÊÓ»¯Ä£Ê½VIMѧϰ±Ê¼Ç7 ¿ÉÊÓ»¯Ä£Ê½
VIMѧϰ±Ê¼Ç7 ¿ÉÊÓ»¯Ä£Ê½
King Hom
?
±¹¾±³¾Óû§ÊÖ²áÖÐÎÄ°æ
±¹¾±³¾Óû§ÊÖ²áÖÐÎÄ°æ±¹¾±³¾Óû§ÊÖ²áÖÐÎÄ°æ
±¹¾±³¾Óû§ÊÖ²áÖÐÎÄ°æ
King Hom
?
¸ßЧÂʱ༭Æ÷ VIM£­²Ù×÷ƪ
¸ßЧÂʱ༭Æ÷ VIM£­²Ù×÷ƪ¸ßЧÂʱ༭Æ÷ VIM£­²Ù×÷ƪ
¸ßЧÂʱ༭Æ÷ VIM£­²Ù×÷ƪ
King Hom
?
ÉèÖÃÓñ¹¾±³¾±à¼­±è²â³Ù³ó´Ç²Ô
ÉèÖÃÓñ¹¾±³¾±à¼­±è²â³Ù³ó´Ç²ÔÉèÖÃÓñ¹¾±³¾±à¼­±è²â³Ù³ó´Ç²Ô
ÉèÖÃÓñ¹¾±³¾±à¼­±è²â³Ù³ó´Ç²Ô
King Hom
?

Git cheat sheet__white

  • 1. Tower ¨C the most powerful Git client for Mac the most powerful Git client for Mac Create Clone an existing repository $gitclonessh://user@domain.com/repo.git Create a new local repository $ git init local Changes Changed files in your working directory $ git status Changes to tracked files $ git diff Add all current changes to the next commit $ git add . Add some changes in file to the next commit $ git add -p file Commit all local changes in tracked files $ git commit -a Commit previously staged changes $ git commit Change the last commit Don¡®t amend published commits! $ git commit --amend Commit History Show all commits, starting with newest $ git log Show changes over time for a specific file $ git log -p file Who changed what and when in file $ git blame file Branches Tags List all existing branches $ git branch Switch HEAD branch $ git checkout branch Create a new branch based on your current HEAD $ git branch new-branch Create a new tracking branch based on a remote branch $ git branch --track new-branch remote-branch Delete a local branch $ git branch -d branch Mark the current commit with a tag $ git tag tag-name Update Publish List all currently configured remotes $ git remote -v Show information about a remote $ git remote show remote Add new remote repository, named remote $ git remote add remote url Download all changes from remote, but don¡®t integrate into HEAD $ git fetch remote Download changes and directly merge/ integrate into HEAD $ git pull remote branch Publish local changes on a remote $ git push remote branch Delete a branch on the remote $ git push remote :branch Publish your tags $ git push --tags Merge Rebase Merge branch into your current HEAD $ git merge branch Rebase your current HEAD onto branch Don¡®t rebase published commits! $ git rebase branch Abort a rebase $ git rebase --abort Continue a rebase after resolving conflicts $ git rebase --continue Use your configured merge tool to solve conflicts $ git mergetool Use your editor to manually solve con- flicts and (after resolving) mark file as resolved $ git add resolved-file $ git rm resolved-file Undo Discard all local changes in your working directory $ git reset --hard HEAD Discard local changes in a specific file $ git checkout HEAD file Revert a commit (by producing a new commit with contrary changes) $ git revert commit Reset your HEAD pointer to a previous commit ¡­and discard all changes since then $ git reset --hard commit ¡­and preserve all changes as unstaged changes $ git reset commit ¡­and preserve uncommitted local changes $ git reset --keep commit 30-day free trial available at www.git-tower.com git cheat sheet presented by fournova
  • 2. Commit Related Changes A commit should be a wrapper for related changes. For example, fixing two diffe- rent bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits. Commit Often Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it¡®s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having few large commits and sharing them rarely, in con- trast, makes it hard to solve conflicts. Don¡®t Commit Half-Done Work You should only commit code when it¡®s completed. This doesn¡®t mean you have to complete a whole, large feature before committing. Quite the contrary: split the feature¡®s implementation into logical chunks and remember to commit early and often. But don¡®t commit just to have something in the repository before leaving the office at the end of the day. If you¡®re tempted to commit just because you need a clean working copy (to check out a branch, pull in changes, etc.) consi- der using Git¡®s ?Stash? feature instead. Test Code Before You Commit Resist the temptation to commit some- thing that you ?think? is completed. Test it thoroughly to make sure it really is completed and has no side effects (as far as one can tell). While committing half- baked things in your local repository only requires you to forgive yourself, having your code tested is even more important when it comes to pushing/sharing your code with others. Write Good Commit Messages Begin your message with a short sum- mary of your changes (up to 50 charac- ters as a guideline). Separate it from the following body by including a blank line. The body of your message should provide detailed answers to the following questions: ¨C What was the motivation for the change? ¨C How does it differ from the previous implementation? Use the imperative, present tense (?change?, not ?changed? or ?changes?) to be consistent with generated messa- ges from commands like git merge. Version Control is not a Backup System Having your files backed up on a remote server is a nice side effect of having a version control system. But you should not use your VCS like it was a backup system. When doing version control, you should pay attention to committing se- mantically (see ?related changes?) - you shouldn¡®t just cram in files. Use Branches Branching is one of Git¡®s most powerful features - and this is not by accident: quick and easy branching was a central requirement from day one. Branches are the perfect tool to help you avoid mixing up different lines of development. You should use branches extensively in your development workflows: for new fea- tures, bug fixes, ideas¡­ Agree on a Workflow Git lets you pick from a lot of different workflows: long-running branches, topic branches, merge or rebase, git-flow¡­ Which one you choose depends on a couple of factors: your project, your overall development and deployment workflows and (maybe most important- ly) on your and your teammates¡® personal preferences. However you choose to work, just make sure to agree on a com- mon workflow that everyone follows. Help Documentation Get help on the command line $ git help command Official Git Website http://www.git-scm.com/ Free online resources http://progit.org http://book.git-scm.org http://gitref.org fournova best practices version control the most powerful Git client for Mac 30-day free trial available at www.git-tower.com