200 likes | 312 Vues
Learn the fundamentals of Git - a distributed version control system for managing projects efficiently. Understand why Git is essential for tracking changes, collaborating, and deploying across various environments. Discover how to install Git, use basic commands such as init, commit, and log, set up remotes, and leverage GUI tools. Enhance your knowledge with valuable resources and practical tips.
E N D
What is git/why do I care? • Install • Basic commands • Remotes • Command line?! There’s a GUI for that. • Resources
Git Git is a distributed version control system. Local and remote repositories Local and remote branches Local and remote tags
Git You want version control if: • You want a record of all changes, so you can restore to previous points • You are working with others • You are deploying to multiple environments, etc.
Git Projects on Drupal.org also use git.
Install Download Git: http://git-scm.com/downloads Follow download instructions
Basic Commands - git git – view all commands $ git
Basic Commands - Init Init - create an empty new repository $ gitinit
Basic Commands - Status Status - show differences between what has been committed and HEAD $ git status
Basic Commands - Add Add – add files to the stage $ git add foo.info
Basic Commands - Commit Commit – stores contents of the index in a commit along with a message $ git commit –m “Added foo.info”
Basic Commands - Log Log– view previous commits $ gitlog
Basic Commands - Checkout Checkout = checkout branches or previous commits $ gitcheckout coolfeaturebranch $ git checkout 1c899fed6ed
Remote Repositories whose branches you track. Free public repos – Github.com – great documentation
Remote - add Add a repository that you track $ git remote add origin git@github.com:brandonneil/test.git
Push Update remote branch with changes from local branch $ git push–u origin master -u = add a tracking reference
Clone Clone a repository into a new directory $ git clone git@github.com:brandonneil/test.git
Pull Fetch from and merge with another repository or local branch $ git pull
Git GUIs http://git-scm.com/downloads/guis Included are “git-gui” and “git-k” We use Git Tower (Mac only) - $59
Resources Git website: http://git-scm.com/ - Reference docs: http://git-scm.com/docs GitImmersion: http://gitimmersion.com/ Version Control for Designers: http://hoth.entp.com/output/git_for_designers.html GitHub:https://help.github.com/ Fundamentals of Software Version Control http://www.lynda.com/Version-Control-tutorials/Fundamentals-Software-Version-Control/106788-2.html