Getting Started With Git

·

3 min read

What is Git?

Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

  • Git is a software.
  • Git is a command-line tool(GitBash).
  • Git is installed locally on the system.
  • Git is focused on version control and code sharing.
  • Git is a version control system to manage source code history.

image.png


What Is GitHub?

GitHub is a web-based Git repository hosting service, which offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.

  • GitHub is a service.
  • GitHub is a graphical user interface.
  • GitHub is hosted on the web.
  • GitHub is focused on centralized source code hosting.
  • GitHub is a hosting service for Git repositories.

image.png


GitHub essentials are:

  • Repositories
  • Branches
  • Commits
  • Pull Requests
  • Git (the version control software GitHub is built on)

    Repository

    A GitHub repository can be used to store a development project.It can contain folders and any type of files (HTML, CSS, JavaScript, Documents, Data, Images).

    Branch

    A GitHub branch is used to work with different versions of a repository at the same time. By default a repository has a master/main branch (a production branch).

    Commits

    In GitHub,changes are called commits. Each commit (change) has a description explaining why a change was made.

    Pull Requests

    Also referred to as a merge request – is an event that takes place in software development when a contributor/developer is ready to begin the process of merging new code changes with the main project repository.


Common Git commands used in various situations:

  • start a working area
  • work on the current change
  • examine the history and state
  • grow, mark and tweak your common history
  • collaborate

    start a working area

    clone - Clone a repository into a new directory

    init - Create an empty Git repository or reinitialize an existing one

    work on the current change

    add - Add file contents to the index

    mv - Move or rename a file, a directory, or a symlink

    restore - Restore working tree files

    rm - Remove files from the working tree and from the index

    examine the history and state

    bisect - Use binary search to find the commit that introduced a bug

    diff - Show changes between commits, commit and working tree, etc

    grep - Print lines matching a pattern

    log - Show commit logs

    show - Show various types of objects

    status - Show the working tree status

    grow, mark and tweak your common history

    branch - List, create, or delete branches

    commit - Record changes to the repository

    merge - Join two or more development histories together

    rebase - Reapply commits on top of another base tip

    reset - Reset current HEAD to the specified state

    switch - Switch branches

    tag - Create, list, delete or verify a tag object signed with GPG

    collaborate

    fetch - Download objects and refs from another repository

    pull - Fetch from and integrate with another repository or a local branch

    push - Update remote refs along with associated objects


Hope you have enjoyed🎉 learning the git commands !💫 Will come with something new next time🚀, till then Keep Learning, Keep Exploring✨