Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Let's talk Git

Let's talk Git

Version Control usage in developers' life. Git fundamentals and basic commands.

Darshan Parikh

October 11, 2019
Tweet

More Decks by Darshan Parikh

Other Decks in Technology

Transcript

  1. Version Control is a system that records changes to a

    file or set of files over time so that you can recall specific versions later.
  2. I am a champion of my own code! - I

    Create files - I Save them - I Edit them - I Save them again!
  3. Working in a team - I create files - You

    create files - Someone else creates files - Save them - I edit my files - You edit my files - Someone else edits your files - Save them again!
  4. Problems? ‍♂ - How do we keep the historical data?

    - More and more folders (takes a lot of space) - How do we merge? - Manual line by line patching (takes a lot of time) - Switch back to the previous version? - Save current and go back to history (again, time and space issues)
  5. Version Control is a system that records changes to a

    file or set of files over time so that you can recall specific versions later.
  6. Centralized Version Control Systems - Concurrent Versioning System (CVS) -

    Subversion (SVN) - Team Foundation Version Control (TFVC)
  7. Main repository Darshan’s repository Distributed Version Control Tapan’s repository Moses’

    repository Darshan’s working directory Tapan’s working directory Moses’ working directory
  8. Why Distributed VCS izz good? - Open source - Scalable

    - Fast (No need of network calls all the time) - Local branching - Easy merging - Snapshots instead of difference (Can revert back easily)
  9. git log - Open source project - Created by Linus

    Torvalds - Released in April 2005 - Maintained by Junio Hamano - Repository: https://git.kernel.org/pub/scm/git/git.git/
  10. Your Daily Tasks - Create things - Save things -

    Edit things - Save things again!
  11. Vocab - Repository (repo) = Project - Working Directory =

    Your existing work environment - Commit = Git’s way of saving things - Staging = Getting things ready - Remote = Some git repository not on your machine (ex. GitHub)
  12. - git checkout -- <file_name> - git checkout -- .

    Revert changes of working directory
  13. Add files staging area - git add - git add

    <file_name> - git add . // adds all the files
  14. - git reset <file_name> // reset specific file - git

    reset . // reset all the files Revert staged files
  15. Commit the changes - git commit // commit after files

    staged - git commit -a // add files to staging and commit - git commit -a -m “<commit_message>” // add commit message
  16. - git log - git log --oneline - git log

    --oneline --graph One line commits with graph
  17. “Version control is a simple concept but its gets complicated

    by the work modes. People working in parallel on the same file at the same time.”
  18. More interesting things - The mind behind Linux | Linus

    Torvalds - Tech Talk: Linus Torvalds on git