introduction to version control
play

Introduction to Version Control Who knows any of these? CVS, - PDF document

About You Who already knows Git? Introduction to Version Control Who knows any of these? CVS, Subversion, using Git and Gitlab Mercurial, Baz, GnuArch 2 / 32 Rmi Emonet Introduction to Version Control using Git and Gitlab About This


  1. About You Who already knows Git? Introduction to Version Control Who knows any of these? CVS, Subversion, using Git and Gitlab Mercurial, Baz, GnuArch 2 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab About This Presentation Version Control Using Git and Gitlab Objectives Introduction to Version Control and Git get convinced by version control systems Git basics learn practical Git skills learn about GitLab for collaboration Schyzophrenic Git hands on with some “code” : a LaTeX paper Collaborating using Git and GitLab (or github) Don't Hesitate Summing it up to ask questions to interrupt me to ping me after, when trying to practice 3 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 4 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab Version Control: What? A version control system (VCS) records what you and your collaborators have done allows easy replication across machines allows you to easily see changes allows you to easily experiment new things Why dropbox/google drive/... is not sufficient safety of your data ownership of your data semantics of your changes Why CVS/Subversion might not be sufficient centralized : a host of the repository working in the train/plane/countryside speed limit SVN-Git migration in progress. 8h to retrieve full SVN history, less than 1min to push full history to Git (same network)! Why? @clem_bouillier 6 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab

  2. Git Version Control Using Git and Gitlab Introduction to Version Control and Git Git (/ ɡɪ t/) is a distributed revision control and source code management (SCM) system with an emphasis on speed, data integrity, and support for distributed, non-linear Git basics workflows. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005, and has since become the most widely adopted version control Schyzophrenic Git system for software development. Collaborating using Git and GitLab (or github) wikipedia Summing it up History of Git open source initiated by Linus Torvalds first release: 7 April 2005 version 2.1.2: 30 September 2014 fast and efficient most used Good alternative: mercurial (hg) 7 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 8 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab Starting with Git Let's try it Initializing your project cp -r base mypaper ; cd mypaper git init git init What's up? git status git add mypaper.tex cvpr.sty git status git status git commit git status Deciding what is relevant ... and more git add file1 file2 … git commit … first: introduce yourself 9 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 10 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab Recap Recap 2 Beginning Keep your project clean: ignoring files .gitignore file(s) git init blabla.* , !blabla.my_precious , *~ git add ... What did I just modify? git commit [-m ...] git status git diff [...] Working git status What happened? git add ... git commit [-m ...] git log 11 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 12 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab

  3. Nota Bene (vs CVS, Subversion) GUI for Git You have the complete repository Bundled with git: git gui have all commits locally Many others (gitg, qgit, GitX, tortoisegit, Netbeans, ...) commit often, fast and everywhere (train, plane, here) merge with 0-stress graphical user interfaces for Git warning: commit ≠ backup huge list of frontends and tools Need to “ git add ” modifications Repository == project SVN has a big tree-shaped repository SVN allows to "checkout" any subtree Git works at the repository level you'll have a set of repository commits are at the repository level 13 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 14 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab Customizing Git Version Control Using Git and Gitlab Introducing yourself Introduction to Version Control and Git Git basics git config --global user.name "John Doe" Schyzophrenic Git git config --global user.email john@doe.com Collaborating using Git and GitLab (or github) Fancy colors and shortcuts Summing it up git config --global color.ui true git config --global alias.st status git config --global alias.ci commit Configuration in ~/.gitconfig 15 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 16 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab About History Back to the Future: parallel universes Remember git log ? git log Each commit is written in stone gitk # or gitg parent(s) commit modifications git checkout 41474a33e098689b... sha1sum (e.g. cb6dc3cb1f4f5eb15c1d9b2b25ae741cd73c0554) can be diff'ed against emacs paper.tex git commit git diff cb6dc3... gitk gitk --all can be retreived ... and more git checkout cb6dc3... … 17 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 18 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab

  4. Recap Recap 2 Branch Moving in the history a label for a commit automatically follows on new commit ( git commit ) git checkout sha1-or-branch-name Always commit before merging commit is cheap, easy and local Creating a new branch at current position you never loose anything when merging Use of “sha1” or branch-name (e.g. brrrr) git checkout -b new-branch-name Shortcuts Merging “brrrr” into “master” cb6dc3, brrrr, HEAD, HEAD^, HEAD~, HEAD~~, HEAD~2, HEAD~42, git checkout master HEAD^2, cb6dc3^42, tagggg git merge brrrr 19 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 20 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab Recap 3 Best Practices Automatic git merge ⇒ automatic commit commit early and often always commit before merge (or pull) On conflicting git merge (partial merge) use meaningful commit messages solve conflict git add avoid committing git commit binary files that change often (NB: word/excel/... are binary) generated files (that can be regenerated in a reasonable time) Exploring history temporary files git log gitk [--all] keep your git status clean log --graph --decorate --oneline --all --color don't put git repositories inside git repositories more 21 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 23 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab Version Control Using Git and Gitlab What is GitLab (and GitHub) Introduction to Version Control and Git GitLab a company providing support and advanced features Git basics an open source project (Community Edition) a web application Schyzophrenic Git collaboration platform Collaborating using Git and GitLab (or github) hosting git repositories visualizing repositories managing issues/tickets Summing it up GitLab offers git repository management, code reviews, issue tracking, activity feeds, wikis. 24 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab 25 / 32 − Rémi Emonet − Introduction to Version Control using Git and Gitlab

Recommend


More recommend