Giter Club home page Giter Club logo

git-session's Introduction

Git-Session

A Free Open Source DVCS ”distributed version control system ”

How it Works!

  • Snapshots, Not Differences

    • Compares SHA1 sum of modified files.
    • Saves the new file as a Whole "easier to retrive lost data"
    • Each Snapshot contains references to the files "to save space uses ref. only"
  • Stores new versions of files only

    N|Solid
  • Each snapshot contains each file

    N|Solid
  • Everything is local “distributed”

    • Each Computer has all the history of the project
    • Makes it faster and easeir to contribute
    • Safer beacuase the data are not onlt on one repo
  • Git has Integrity

    • Everything in Git is CHECKSUMMED "fast ,reliable"
    • Uses SHA-1 hash "a 40 hexadecimal char string"
    • Easy to recognize corrupted files.
  • Git Generally Only Adds Data "Everything is almost reversible"

Files’ Three States

  • Modified
  • Staged
  • Committed

Installtion

$ sudo apt update
$ sudo apt intsall git

First Time Configurations

git config --global user.name "John Doe"
git config --global user.email [email protected]
git config --global core.editor nano
git config --global merge.tool meld 

Git Help

git has a really good command manual for each command

$ git help <command>
$ man git <command>
$ git <command> -h #summarized

Important Terms

  • Repository
  • Index “Staging area”
  • working tree “Project tree”
  • Commit
  • Branch
  • Tag
  • Master
  • Head

Git Basics

  • Git Repository

$ git init # Intialize a Embty/new repository
$ git clone <URL># to Clone/Copy exsiting repository

<URL>: can be git, shh, http, https, file , etc

  • Recording Changes to the Repository

    N|Solid

    • Checking status of your files

      $ git status`
      $ git status -s # Summarized
      • ?? “ untraked ”
      • A “ staged ”
      • M “ Modified staged “
      • M “ Modified untracked “ Example:
      $ git status
      $ echo 'I' > README #creates a new file
      $ git status
    • Staging Modified Files

      Stage your files after adding not before
      $ git add <files|WildCards> 
      Example:
      $ git add README
      $ git status
      $ echo “USE” >> README
      $ git status
      $ git add README
      $ git status
    • Ignoring Files

      A file listing patterns to match them with files in your repositories. File name “.gitignore”
  • Viewing staged and unstaged

    $ git status
    $ git diff #diffreneces between commited  and modified/untracked
    $ git diff --staged #diffreneces between commited and modified/tracked/staged

    Example 1

    $ git commit -am “cleaning the stage”
    $ echo “Git” >> README
    $ echo  “Git” > Cont.md
    $ git add README Cont.md
    $ git diff # 
    $ echo “OSC” > Cont.md
    $ git status
    $ git diff

    Example 2

    $ git commit -am “cleaning the stage”
    $ echo “1” > file
    $ git add file && git commit -m “new file”
    $ echo “2” > file
    $ git add file
    $ echo “3” >file
    $ git diff
    $ git diff --staged
    • Committing Changes

      git commit
      git commit -m "short Message"
      git commit -am “Your Message” #Stage all untracked files and commit all files in staged area
      Example
      $ git commit -am “cleaning the stage”
      $ echo “1” > newfile
      $ git commit -am “new file”
      $ git status
      $ git add newfile && git commit -m “new file”
      # Change “newfile” and try using commit -am “changed new file”
    • Remove

      git rm <file name| wild card>
    • Move

      git mv <file name| wild card>
    • Commit History

      $git log
      $ git log -p
      $ Git log -<number>
      $ git log --since <date>
      $git log --until <date>
      <data>or <number> EX : “ 2008-01-15” or EX : "2 years 1 day 3 minutes ago"

git-session's People

Contributors

anieo avatar

Watchers

 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.