Well technically, Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity,and support for distributed, non-linear workflows.
Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development.
Let's understand it in more convienent way!
Suppose, You googled something very important topic regarding your work. And you came across a perfect set of content, But mistakenly you haven't saved it at that point time and moved on to another task.
After a while, you are trying to remember what content was that you have found on the internet previously? But now you forgot it completely.
Fortunately, every browser has a feature of browsing history. So, having that in mind as you hit the browser history section to find out the piece of content.
Browser history shows you all the searches and activities that you have done till that point of time. Now from that plethora of options you have to filter out the right option that you want to go with.
After filtering out the options from the browser history you got the content that you are looking for!
In simple language we can say that just like browser history, Git tracks your source code what changes have you done so far, it is kind of a source code history feature. You can find it any changes, whether it is big or small And you can go back and forth to any changes that you have stored in git.
The working directory is simple, your current directory on your system that you are working on.
The staging area is acting as a bridge between your working directory & local repository, In staging area new files (a.k.a. untracked-files) are added so that these new files further add-up to local repository through commit.
Local repository is your working directory in your local machine or personal computer. Where you make changes locally and that is tracked by the git.
A remote repository is a git repository hosted on the Internet or some other network, it is a common repository that all team members use to exchange their changes in the source-code development. It is just cloud storage.
Initialize operation is used to initialize or to create a git repository.
This operation adds a change in the working directory to the staging area. Basically, it tells git that you have to include the updates to a particular file for the next commit.
This operation captures the snapshot of the working directory. So, that it can compare the changes in future commits (Master branch is always headed to last commit).
This operation is used to fetch and download content from a remote repository and immediately update the local repository to match that content.
This operation is used to upload local repository content to a remote repository. It is opposite of pull Operation.
This operation creates a branch for independent line of development. You can think of them as a way to request a brand new working directory, staging area, And project history for parallels contribution and development (Default branch in git is master branch).
This operation lets you take the independent lines of development created by git branch and integrate them into a single branch i.e. to master branch.
This is also a way of combining the work between different branches. Rebasing takes a set of commits, copies them and stores them outside your repository. The advantage of rebasing is that it can be used to make a linear sequence of commits.
$ git config --global user.name "YourUser_Name"
$ git config --global user.email your@email.com
$ git init
$ git add filename
$ git add * [to add all file]
$ git rm [filename]
$ git commit -m "Commit message"
$ git status
$ git reset [file]
$ git reset [commit]
$ git log
$ git remote add origin [server]
$ git push origin master
$ git branch
$ git checkout [branchname]
$ git checkout -b [branchname]
$ git branch -d [branchname]
$ git push origin :[branch name]
$ git push origin [branchname]
$ git push –all [variable name]
$ git clone [URL]
$ git pull
$ git merge [branchname]
$ git diff
$ git rebase master