Git: git Add, git Commit, git Push, git Status,git Pull,git Merge


Why Git?
->Git is version-??control software.We can also say GIT is a tool to manage software development process.
 It keeps track of all the changes to your files in a project repository .
Its powerful tools let you view your changes, helping you fix your code so that it’s free of a certain bug.
Git really changed the way developers think of merging and branching. Merging/branching has always been
considered a bit scary.But with Git, these actions are extremely cheap and simple, and they are considered
 one of the core parts of your daily workflow.

What is repository?
->A repository is a collection of files and directories (your project), as well as a list of changes
to those files over the life of the repository.

What is Origin?
->origin is the default name of the remote git repository.The central repository holds two main
 branches with an infinite lifetime:
(a)origin=Origin is the main branch of repository where last commit held. This origin/master always
 modify at last commit and ready for production state.
(b)develop=Parallel to the master branch, another branch exists called develop.We consider
 origin/develop to be the main branch where the source code of HEAD always reflects a state
with the latest delivered development changes for the next release(commit, then update origin/master).

Basic Terms in Git.
Branching->Branching is a process of making new copy of origin repository(basically master branch) for
 further modification which independent from from origin branch and ultimately we can merge when happy with our new creation. So ultimate Git will allow you to have
 multiple local branches that can be entirely independent of each other and the creation, merging
 and deletion of those lines of development.Git makes this process incredibly easy and it changes
 the way most developers work when they learn it.
Merging->Merging is just opposite of branching. In case of branching we had created a new branch from origin/master but In case of merging we
merge the new created branch from origin/master. It seems too easy as like branching, it's really easy up to single developer OR no changes in local
 branch. The pull command in fact fetches commits and then merges them into your current branch. If you have no local changes, then the merge is a fast
 forward. But if you do have local changes, Git will automatically merge, and report any conflicts.
Now we have basic understanding of GIT and it's related terms. So let's go ahead!!!!!!!!
 
1. init
Init is first command in git. which we has use to Create an empty git repository or reinitialize an existing repository if already created.
if we type git init command on Git Bash it will reply

if you look in command prompt before $git init, git_example repository was not a master. After git init it will reply message
$ git init
Initialized empty Git repository in c:/Sites/git_example/.git/
2.Status
Displays paths that have differences between the previous commit and the current HEAD commit. It shows current branch you working on, The files you modify
since they were last committed, and which files Git knows nothing about. It will indicate if files have been moved or deleted, or if there are merges
that need to be made manually.
$git stauts


 Basically it keep track of three type's of file.
a)File we had committed earlier.
b) Untrack file which still to added to repository.
c)One's more untrack file about which git does not know any thing.
Some more option with $git status for more info.
$git status --short/-s
Give the output in the short-format.
$git status --branch/ -b 
Show the branch and tracking info even in short-format.
$git status --ignored
Show ignored files as well.

3.Add
This command adds the current content of new or modified files to the .git repository, thus staging that content for inclusion in the next commit.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s