Giter VIP home page Giter VIP logo

git-workshop's Introduction

Git Workshop

Hello ๐Ÿ‘‹ Welcome to Git Workshop. It's a very simple repository containing the basics of Git, some theory, good practices and exercises. Hope you'll learn something new and enjoy whatever it is that you find here โœจ

What is Git?

Git is a version control system allowing for users to share their work (in most cases - programming) and publish it, a collaboration tool. Git works using hashes in a key-value form to save every action taken on the software. Every object has it's hash value, which Git uses to navigate to whenever a change is made. The structure resembles a tree ๐ŸŒณ Additionally, each user has it's own copy of the repository on their local machine (contrary to an SVN system). Another big difference between git and other version control systems is access to the local history. In most cases you don't need to change your history of the files, however it's permitted. Git generally isn't a good place for storing big files (you can, however use the git-lfs)

Branches

As mentioned before, git has a tree-like structure ๐ŸŒณ it operates on branches, which can be merged/rebased/pulled from/pushed into whatever you need.

Common Misconceptions

  1. You will break the git repository with one push - that's not true. Git is easy to learn, but hard to master. For one push to destroy the whole repository, well... that requires a lot of skill.
  2. You only commit when the feature is production-ready - think of commits as more of 'updates' on the process.
  3. Merge/rebasing is scary - unless you're using force push then everything will be alright.

Basic Commands

  1. Add -> stage a change. Never use git add . , as you could potentially stage files that are not supposed to be changed or added. Be careful when adding whole directories too, as it adds every file in said directory. For example, if somebody wanted to push a picture of a graph, you should use git add pictures/graph.png, otherwise it might add files like funny_picure.png, my_moms_dinner.png...
  2. Commit -> commit staged changes. Remember to use proper messages to commit!
  3. Push -> push commited changes
  4. Rebase -> when working as an internal collabolator; moves entire changes to the branchs' HEAD; changes the history!
  5. Merge -> similarly to rebase, but doesn't change the history nor any of the existing branches.
  6. Checkout -> to switch a branch
  7. Status -> see the current status of repository to let you monitor which changes have been staged, which haven't, and which files aren't being tracked by Git
  8. Stash -> stashes changes for later use
  9. Fetch -> saves changes from a remote repository without applying them with checkout/pull
  10. Restore -> restores a file from changes made on it.

Remote vs Origin

Remote is a repository on a server. Origin is your local version, stored on the device.

You can add to remote (if you're workng on forks for instance) by using git remote add <name> <url>.

git_remote

Exercises:

  1. Fork this repository
  • Make a branch
  • Make some changes
  • Stage your changes
  • Commit those changes
  • Create a PR
  • Use git merge
  • Push to official repository
  1. Clone the repository
  • Make a branch
  • Make some changes
  • Stage your changes
  • Commit those changes
  • Create a PR
  • Use git rebase
  • Push to official repository

For engineering team

  1. Pull a branch from forked repository of the person on yor right
  2. Make some changes and push them to branch from 3.

git-workshop's People

Contributors

lzuchowska avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.