Git Product home page Git Product logo

git_github_documentation's Introduction

Git & GitHub Documentation

Lesson 1. Introduction to git and GitHub

  1. git ?
    • git is a version control software
    • It keep track of code changes
    • It helps to collaborate in a project
    • It is installed and maintained locally
    • It provides Command Line Interface (CLI)
    • Released in April 7, 2005
    • Developed by Linus Torvalds & Junio C Hamano
  2. github?
    • GitHub is a hosting service where we can keep our git repositiory/folders
    • It is maintained on cloud/web
    • It provides Graphical User Interface (GUI)
    • Founded in 2008

Lesson 2. How to set git environment and configuration

  • Download and install git on your pc: https://git-scm.com/
  • check git version: open terminal or cmd then use the command git --version to find out whether git is installed or not. if git is installed it will return a version number of git.

git configuration

  1. check all configuartion options: git config
  2. set global user name and user email for all repository/git folders (if you want to set different username and email for different git repository then remove --global)
    • set global user name: git config --global user.name "Badsha Faysal"
    • set global user email: git config --global user.email "[email protected]"
  3. list all git configuration:
    • list all the configuration: git config --list
    • list user name: git config user.name
    • list user email: git config user.email
  4. change global username & email
    • change global user name: git config --global user.name "PUT_NEW_USER_NAME_HERE"
    • change global user email: git config --global user.email "PUT_NEW_USER_EMAIL_HERE"

Lesson 3. creating git repo and adding new files

  1. creating a git folder
  • ls -a : list all files inside of a directory

    mkdir DIRECTORY_NAME_HERE
    cd DIRECTORY_NAME_HERE
    git init
    
    Example:
    mkdir folder1
    cd folder1
    git init
    ls -a
    
  1. adding new files in git folder
  • git status : displays the state of the working directory and staging area

    ls -a
    touch fileName.extension
    open fileName.extension
    git status
    
    Example:
    touch day1.txt
    open day1.txt
    write something inside the file
    
  • Git is aware of the file but not added to our git repo

  • Files in git repo can have 2 states โ€“ tracked (git knows and added to git repo), untracked (file in the working directory, but not added to the local repository)

  • To make the file trackable stagging or adding is required


Lesson 4. how to add files in staging area & remove files

  1. adding files to stagging area:
  • git add fileName add a file in staging area / index
  • git add . add all files of directory to stagging area not subdirectory
  • git add -A add all files of directory and subdirectory to stagging area
  • git rm --cached fileName unstage a file from staging area
  • git diff - checking the differences of a staged file
  • git restore fileName - restore the file

Lesson 5. commit & uncommit

  • git commit -m "message" move the file to local repository from stagging area
  • git log check the commit history
  • git reset --soft HEAD^ uncommit the commit in HEAD and move to staging area
  • git reset HEAD^ uncommit the commit in HEAD and move to unstaging / working area
  • git reset --hard HEAD^ uncommit the commit in HEAD and delete the commit completely with all the changes

Lesson 6. git HEAD and undo theory

  • git log --oneline
  • git show
  • git show HEAD^
  • git show commit-id
  • git checkout commit-id
  • git checkout master

Lesson 7. git ignore

  • create a .gitignore file and add the things you do not want to add in the stagging area
  • Inside .gitignore we can keep secret files, hidden files, temporary files, log files
  • secret.txt secret.txt will be ignored
  • *.txt ignore all files with .txt extension
  • !main.txt ignore all files with .txt extension without .main.txt
  • test?.txt ignore all files like test1.txt test2.txt
  • temp/ all the files in temp folders will be ignored

Lesson 8. how to create github repository and commits

  • sign in to your github account
  • create a git repo

Lesson 9. README.md

  • 6 heading levels: number of hashes define heading levels. check the following examples:

    • # heading 1 level text is here
    • ## heading 2 level text is here
  • bold syntax: **text goes here**

  • italic syntax: _text goes here_

  • bold and italic syntax: **_text goes here_**

  • strikethrouh syntax: ~~this is~~

  • single line code syntax: `` place code inside backticks

  • multiple line code syntax: ``` place code inside three open and closing backticks

  • multiple line code syntax language specific: ```html for specific lanaguage use language name when starting; not closing

  • Ordered List syntax

    ```
         1. HTML
          2. CSS
    
             1. Fundamental
             2. CSS Architecture - BEM
             3. CSS Preprocessor - SASS
    
          3. JS
    ```
    
  • Unordered List syntax ->

     - html
     - css
       - Fundamental
       - CSS Architecture - BEM
       - CSS Preprocessor - SASS
     - js
    
  • Task List

       - [x] Task1
       - [x] Task2
       - [x] Task3
    
  • adding link

       <!-- automatic link -->
    
       https://github.com/me-badsha
    
       <!-- markdown link syntax -->
       [title](link)
       [BadshaGithub](https://github.com/me-badsha)  
       [BadshaGithubis][websitelink]
    
       <!-- all link is here  -->
    
       [BadshaGithub]: https://github.com/me-badsha
    
    
  • adding image syntax -> ![alt text](imageURL) ![1800 milestone](https://i.postimg.cc/qvZpmxKF/1-800-Uploads-Milestone.png)


### Lesson 10. Adding emoji
  • adding emoji
    emoji src ### Smileys ๐Ÿ˜€ ๐Ÿ˜ƒ ๐Ÿ˜„ ๐Ÿ˜ ๐Ÿ˜† ๐Ÿ˜… ๐Ÿ˜‚ ๐Ÿคฃ ๐Ÿฅฒ โ˜บ๏ธ ๐Ÿ˜Š ๐Ÿ˜‡ ๐Ÿ™‚ ๐Ÿ™ƒ ๐Ÿ˜‰ ๐Ÿ˜Œ ๐Ÿ˜ ๐Ÿฅฐ ๐Ÿ˜˜ ๐Ÿ˜— ๐Ÿ˜™ ๐Ÿ˜š ๐Ÿ˜‹ ๐Ÿ˜› ๐Ÿ˜ ๐Ÿ˜œ ๐Ÿคช ๐Ÿคจ ๐Ÿง ๐Ÿค“ ๐Ÿ˜Ž ๐Ÿฅธ ๐Ÿคฉ ๐Ÿฅณ ๐Ÿ˜ ๐Ÿ˜’ ๐Ÿ˜ž ๐Ÿ˜” ๐Ÿ˜Ÿ ๐Ÿ˜• ๐Ÿ™ โ˜น๏ธ ๐Ÿ˜ฃ ๐Ÿ˜– ๐Ÿ˜ซ ๐Ÿ˜ฉ ๐Ÿฅบ ๐Ÿ˜ข ๐Ÿ˜ญ ๐Ÿ˜ค ๐Ÿ˜  ๐Ÿ˜ก ๐Ÿคฌ ๐Ÿคฏ ๐Ÿ˜ณ ๐Ÿฅต ๐Ÿฅถ ๐Ÿ˜ฑ ๐Ÿ˜จ ๐Ÿ˜ฐ ๐Ÿ˜ฅ ๐Ÿ˜“ ๐Ÿค— ๐Ÿค” ๐Ÿคญ ๐Ÿคซ ๐Ÿคฅ ๐Ÿ˜ถ ๐Ÿ˜ ๐Ÿ˜‘ ๐Ÿ˜ฌ ๐Ÿ™„ ๐Ÿ˜ฏ ๐Ÿ˜ฆ ๐Ÿ˜ง ๐Ÿ˜ฎ ๐Ÿ˜ฒ ๐Ÿฅฑ ๐Ÿ˜ด ๐Ÿคค ๐Ÿ˜ช ๐Ÿ˜ต ๐Ÿค ๐Ÿฅด ๐Ÿคข ๐Ÿคฎ ๐Ÿคง ๐Ÿ˜ท ๐Ÿค’ ๐Ÿค• ๐Ÿค‘ ๐Ÿค  ๐Ÿ˜ˆ ๐Ÿ‘ฟ ๐Ÿ‘น ๐Ÿ‘บ ๐Ÿคก ๐Ÿ’ฉ ๐Ÿ‘ป ๐Ÿ’€ โ˜ ๏ธ ๐Ÿ‘ฝ ๐Ÿ‘พ ๐Ÿค– ๐ŸŽƒ ๐Ÿ˜บ ๐Ÿ˜ธ ๐Ÿ˜น ๐Ÿ˜ป ๐Ÿ˜ผ ๐Ÿ˜ฝ ๐Ÿ™€ ๐Ÿ˜ฟ ๐Ÿ˜พ

    ### Gestures and Body Parts
    ๐Ÿ‘‹ ๐Ÿคš ๐Ÿ– โœ‹ ๐Ÿ–– ๐Ÿ‘Œ ๐ŸคŒ ๐Ÿค โœŒ๏ธ ๐Ÿคž ๐ŸคŸ ๐Ÿค˜ ๐Ÿค™ ๐Ÿ‘ˆ ๐Ÿ‘‰ ๐Ÿ‘† ๐Ÿ–• ๐Ÿ‘‡ โ˜๏ธ ๐Ÿ‘ ๐Ÿ‘Ž โœŠ ๐Ÿ‘Š ๐Ÿค› ๐Ÿคœ ๐Ÿ‘ ๐Ÿ™Œ ๐Ÿ‘ ๐Ÿคฒ ๐Ÿค ๐Ÿ™ โœ๏ธ ๐Ÿ’… ๐Ÿคณ ๐Ÿ’ช ๐Ÿฆพ ๐Ÿฆต ๐Ÿฆฟ ๐Ÿฆถ      ๐Ÿ‘ฃ ๐Ÿ‘‚ ๐Ÿฆป ๐Ÿ‘ƒ ๐Ÿซ€ ๐Ÿซ ๐Ÿง  ๐Ÿฆท ๐Ÿฆด ๐Ÿ‘€ ๐Ÿ‘ ๐Ÿ‘… ๐Ÿ‘„ ๐Ÿ’‹ ๐Ÿฉธ
    
  • adding table

       table syntax
       | heading1 | heading2 |
       | ----- | ----- |
       | data1 | data2 |
       | data3 | data4 |
       | data5 | data6 |
    

Lesson 11. Connecting local repo to remote repo

  • check remote connection: git remote or git remote -v
  • git remote add name <REMOTE_URL> example: git remote add origin http://...
  • to clone a remote repository: git clone <REMOTE_URL>

Lesson 12. push and pull

  • push a branch git push -u origin branch_name
  • push all branches git push --all
  • pull from a repo: git pull which is equivalent to git fetch + git merge

Lesson 13. branching and merging

  • Branch is a new and separate branch of master/main repository
  • create a branch git branch branch_name
  • List branches git branch
  • List all remote branches git branch -r
  • List all local & remote branches git branch -a
  • move to a branch git checkout branch_name
  • create and move to a branch git checkout -b branch_name
  • delete a branch: git branch -d branch_name
  • merge branches:
      git checkout branchName
      git merge branchName
    
  • git log --oneline --all --graph

Lesson 14. 2-way and 3-way merges


Lesson 15. Merge Conflicts


Thanks for read....

git_github_documentation's People

Contributors

me-badsha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

suny-webdevs

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.