top of page

A-Git-Chatroom [Part-1]

Updated: Feb 3, 2020

Introduction:


ree

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Now, that's the definition of Git on its official website (https://git-scm.com/ ), so before beginning let us look at the What git is(?), basics of git, basic functions of git and finally creating a chatroom using Git.

So,


What is Git?

Git is a distributed version control system. Different from a central version control system (Eg: SVN), a distributed version control system allows every user to have a local repository. This local repository has all of the information that your remote repository has based on the last time you synced those two togeather. This allows us to view the different changes made in the remote repository locally (git log).


Now why would someone need this. The answer to this question is simple, why not? You get to keep different versions of your code, allowing better management. Multiple people can work on the same code, as well as, it provides for a neat and clean way to push commits or changes to a source code you're working on. You can form branches on which you can code for special instructions or specific tasks and a master meant for generic or general tasks. A huge part of the professional industry, depends on version control systems like Git. Also thw whole open source community depends on Git


Now that you know what Git is; As the creator of Git, Linus Torvalds, says: "I'm really, really, really bad at doing slides, which means that if we actually end up following these slides, you will be bored out of your mind". lets just begin with some commands.


Some Basic Commands:


Now on typing a simple "git" followed by a ↵. We get the following output:

ree

Let us look at each of them one-by-one:


A) start a working area (see also: git help tutorial)

Under this section we see two commands namely:

1) clone: Clones a repository into a new directory. (git clone <url> <path>)

2) init : Create an empty Git repository or reinitialize an existing one. (git init)


B) work on the current change (see also: git help everyday)

Under this section we see four commands namely:

1) add: Add file contents to the index (git add -A) [-A add all files to the index]

2) mv: Move or rename a file, a directory, or a symlink (git mv <source> <destination>)

3) restore: Restore working tree files (git restore <file_name>)

4) rm: Remove files from the working tree and from the index (git rm <file_name>)


C) examine the history and state (see also: git help revisions)

Under this section we have two important commands namely:

1) status: Show the working tree status (git status)

2) log: Show commit logs (git log)


D) grow, mark and tweak your common history

Under this section we have four main commands namely:

1) branch: List, create, or delete branches (git branch)

2) commit: Record changes to the repository (git commit -m "<update_name>")

3) merge: Join two or more development histories together (git merge)

4) checkout: Switch branches (git checkout <branch_name>)


E) collaborate (see also: git help workflows)

Under this section we have three main commands namely:

1) fetch: Download objects and refs from another repository (git fetch)

2) pull: Fetch from and integrate with another repository or a local branch (git pull origin <branch_name>) [ "origin" is a shorthand name for the remote repository that a project was originally cloned from.]

3) push: Update remote refs along with associated objects (git push remote <branch_name>)


We will look at creating a basic Chatroom next time. We will use python and its submodule "subprocess". >>>>>

Comments


09748303416

  • linkedin
  • linkedin

©2020 by XORbians.

Subscribe Form

bottom of page