Difference between revisions of "Git Howto"
m |
(Remove dead link) |
||
(13 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
Git is similar to CVS, SVN, etc. but the cheap local branching make it feasible to use a very powerful workflow where you can checkout, try something, backup, test something different, switch back to attempt 1 -- all without losing any of your work. You can also easily merge between these different branches and push-pull pieces of commits from others. It is ideal for the kind of highly distributed development we do at JLab. | Git is similar to CVS, SVN, etc. but the cheap local branching make it feasible to use a very powerful workflow where you can checkout, try something, backup, test something different, switch back to attempt 1 -- all without losing any of your work. You can also easily merge between these different branches and push-pull pieces of commits from others. It is ideal for the kind of highly distributed development we do at JLab. | ||
− | Some general links to help users come up to speed with git. | + | |
+ | == Some general links to help users come up to speed with git. == | ||
+ | |||
* [http://git-scm.com/about/ About git] A quick read on what makes git different, and why you should care. | * [http://git-scm.com/about/ About git] A quick read on what makes git different, and why you should care. | ||
* [http://teamtreehouse.com/blog/why-you-should-switch-from-subversion-to-git Why You Should Switch from Subversion to Git]: This article lays out the differences between git and svn/cvs. Comments for and against are interesting too. | * [http://teamtreehouse.com/blog/why-you-should-switch-from-subversion-to-git Why You Should Switch from Subversion to Git]: This article lays out the differences between git and svn/cvs. Comments for and against are interesting too. | ||
* [http://nvie.com/posts/a-successful-git-branching-model/ A successful Git branching model]: A well written post how to take advantage of what makes git unique. | * [http://nvie.com/posts/a-successful-git-branching-model/ A successful Git branching model]: A well written post how to take advantage of what makes git unique. | ||
− | + | ||
* [http://git-scm.com/ git Homepage] | * [http://git-scm.com/ git Homepage] | ||
* [http://git-scm.com/documentation git's "Official" documentation] | * [http://git-scm.com/documentation git's "Official" documentation] | ||
** This contains links to How To videos, as well as "Getting started" and "Git Basics" tutorials. | ** This contains links to How To videos, as well as "Getting started" and "Git Basics" tutorials. | ||
* [https://github.com/training/free Free GitHub Class]: GitHub runs these web seminars every few weeks. Keep an eye out for a seminar that you might find interesting and sign up. | * [https://github.com/training/free Free GitHub Class]: GitHub runs these web seminars every few weeks. Keep an eye out for a seminar that you might find interesting and sign up. | ||
+ | |||
+ | === Git Tutorials/How-tos === | ||
+ | * [http://www-cs-students.stanford.edu/~blynn/gitmagic/ch02.html Git Magic]: Very good 'web book' -- an excellent place to start. | ||
+ | * [http://git-scm.com/book Pro Git]: An open-source, free, book on how to work with git (PDF, and eBook formats). For starters through experts. | ||
+ | * [http://ndpsoftware.com/git-cheatsheet.html Interactive cheatsheet] for git ([[Media:git-cheat-sheet-large.png|Printable Local Copy]]) | ||
+ | * How to [http://justinhileman.info/article/git-pretty/git-pretty.png Escape a git mess] Great flowchart to help you out when you're stuck ([[Media:Gitfix.png|Local copy]]) | ||
+ | * [http://marklodato.github.com/visual-git-guide/index-en.html Visual Git Reference]: Very concise with some nice simple graphics to show how commands move files from one 'state' to another -- excellent quick reference. | ||
* [http://schacon.github.com/git/everyday.html Everyday GIT With 20 Commands Or So]: Nice site that walks through some "typical" development tasks. | * [http://schacon.github.com/git/everyday.html Everyday GIT With 20 Commands Or So]: Nice site that walks through some "typical" development tasks. | ||
− | *[http:// | + | * [https://www.youtube.com/watch?v=1ffBJ4sVUb4 Git For Ages 4 And Up]: An excellent git video tutorial that really helped me understand how git functions. Good for beginners, even better for folks who have played with git a little bit and recognize the basic commands. |
+ | * Brad's [https://hallaweb.jlab.org/wiki/index.php/Git_Cheatsheet#A_Cheat_Sheat_for_How_To_Use_Git "Git Cheat-sheet"]: 7 steps to developing with git. | ||
+ | * Simona's fave git tutorial for beginners: [https://www.youtube.com/watch?v=BCQHnlnPusY "Git and GitHub for Poets"] | ||
+ | |||
+ | === Git Workflows === | ||
+ | * [http://scottchacon.com/2011/08/31/github-flow.html Git flow used by GitHub] | ||
+ | * [http://sandofsky.com/blog/git-workflow.html Understanding the Git Workflow] | ||
+ | |||
+ | == Tweaks: == | ||
+ | * Add the current git branch and status to your '''bash''' prompt | ||
+ | ** Save [[git-prompt.sh]] to '~/bin/git-prompt.sh' under your account | ||
+ | ** Edit your ~/.bashrc file and add this line somewhere towards the end | ||
+ | [ -r ~/bin/git-prompt.sh ] && source ~/bin/git-prompt.sh | ||
+ | |||
+ | * Add the current git branch and status to your '''csh/tcsh''' prompt (see Note[1] below). | ||
+ | ** Save [[gitprompt.pl]] to '~/bin/gitprompt.pl' under your account | ||
+ | ** Edit your ~/.cshrc (or ~/.tcshrc) file and add these lines somewhere towards the end | ||
+ | if ( $?prompt && -x /usr/bin/git && -x $HOME/bin/gitprompt.pl ) then | ||
+ | alias precmd $HOME/bin/gitprompt.pl | ||
+ | endif | ||
+ | |||
+ | NOTE[1]: If you are on a CUE machine you may need to change '/usr/bin/git' to '/apps/bin/git' in the above lines AND in the gitprompt.pl script. | ||
+ | NOTE[2]: These call 'git status' to generate the prompt and so can cause the shell to stall for a short period if the git metadata isn't cached. I only find this delay noticable for really big repositories like the linux kernel. Once the git info is cached, (ie. after the first longish delay) the prompt returns very quickly again. | ||
+ | ---- | ||
<font color=red>'''NOTE:''' If you find a resource that you really appreciate. ''PLEASE ADD IT TO THE LIST!''<font> | <font color=red>'''NOTE:''' If you find a resource that you really appreciate. ''PLEASE ADD IT TO THE LIST!''<font> | ||
[[category:12GeV Software]] | [[category:12GeV Software]] |
Latest revision as of 16:37, 12 November 2020
From the git homepage:
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
Git is similar to CVS, SVN, etc. but the cheap local branching make it feasible to use a very powerful workflow where you can checkout, try something, backup, test something different, switch back to attempt 1 -- all without losing any of your work. You can also easily merge between these different branches and push-pull pieces of commits from others. It is ideal for the kind of highly distributed development we do at JLab.
Some general links to help users come up to speed with git.
- About git A quick read on what makes git different, and why you should care.
- Why You Should Switch from Subversion to Git: This article lays out the differences between git and svn/cvs. Comments for and against are interesting too.
- A successful Git branching model: A well written post how to take advantage of what makes git unique.
- git Homepage
- git's "Official" documentation
- This contains links to How To videos, as well as "Getting started" and "Git Basics" tutorials.
- Free GitHub Class: GitHub runs these web seminars every few weeks. Keep an eye out for a seminar that you might find interesting and sign up.
Git Tutorials/How-tos
- Git Magic: Very good 'web book' -- an excellent place to start.
- Pro Git: An open-source, free, book on how to work with git (PDF, and eBook formats). For starters through experts.
- Interactive cheatsheet for git (Printable Local Copy)
- How to Escape a git mess Great flowchart to help you out when you're stuck (Local copy)
- Visual Git Reference: Very concise with some nice simple graphics to show how commands move files from one 'state' to another -- excellent quick reference.
- Everyday GIT With 20 Commands Or So: Nice site that walks through some "typical" development tasks.
- Git For Ages 4 And Up: An excellent git video tutorial that really helped me understand how git functions. Good for beginners, even better for folks who have played with git a little bit and recognize the basic commands.
- Brad's "Git Cheat-sheet": 7 steps to developing with git.
- Simona's fave git tutorial for beginners: "Git and GitHub for Poets"
Git Workflows
Tweaks:
- Add the current git branch and status to your bash prompt
- Save git-prompt.sh to '~/bin/git-prompt.sh' under your account
- Edit your ~/.bashrc file and add this line somewhere towards the end
[ -r ~/bin/git-prompt.sh ] && source ~/bin/git-prompt.sh
- Add the current git branch and status to your csh/tcsh prompt (see Note[1] below).
- Save gitprompt.pl to '~/bin/gitprompt.pl' under your account
- Edit your ~/.cshrc (or ~/.tcshrc) file and add these lines somewhere towards the end
if ( $?prompt && -x /usr/bin/git && -x $HOME/bin/gitprompt.pl ) then alias precmd $HOME/bin/gitprompt.pl endif
NOTE[1]: If you are on a CUE machine you may need to change '/usr/bin/git' to '/apps/bin/git' in the above lines AND in the gitprompt.pl script.
NOTE[2]: These call 'git status' to generate the prompt and so can cause the shell to stall for a short period if the git metadata isn't cached. I only find this delay noticable for really big repositories like the linux kernel. Once the git info is cached, (ie. after the first longish delay) the prompt returns very quickly again.
NOTE: If you find a resource that you really appreciate. PLEASE ADD IT TO THE LIST!