There is no CVS no subversion.
What is GIT?
1. Version Control System
2. Distributed Version Control System
Where is it used ?
1. Linux kernel
3. Xorg and XServer
What do you mean by distributed?
Every dev has full copy, which keeps all history. No concept of centeral server.
Most operations are local unless we are doing push or pop. So its very fast.
How we can work ?
1. Single Developer :-
LAPTOP ———-> USB|Sever
2. Multiple Developer :-
Dev1 ——> Server ——> Dev2
* In Subversion/CVS
forced to use central server Dev only have copy of current state
* GIT (Distributed)
work how we want single dev, centeral server, dictation, heirarichal All working copies are full repos i.e. contains all history of all repo.
- Create Project
- Add files
- Commit changes
- Push changes
Basic Commands of GIT
Doing Global Settings.
git config --global user.name "anyUserName" git config --global user.email "emailId"
we can see the above settings as: (Below is the linux command)
Now lets check how to make git directory i.e. make a directory in we will keep the repo.
Intializing git repo
git init .
To check the status
If you make a file under the current directory and then you run the command
(git will tell you that there is a file but it is not going to keep track of this.)
git add <file name>
git add . (Will add all the files) git commit <file name>
git commit . (will commit all the files)
GIT Vs Subversion
repo repersented as a number. start at 1 then increment it
each file gets a version number 1.1, 1.2, 1.3 each commit gets a number which is SHA1 hash guarantees content of Repo promise that what we put in is what we get out
Lets see more GIT commands:
* Now edit a file and save it and then do
It will twll a file is updated but if we do (git commit) then nothing it shows there is nothing to commit.
Lets Check Why
Before commit we have to first add the file to the staging area, which we can do by
git add <file name>
and at this time we can also rollback the file by * git reset
We can also see the logs by :
What if we want the file to get committed directly without pushing it to the staging area
git commit -A
Now lets check how to push the files to remote repo:
Make one git repo (i.e. the remote repo) by:
git init --bare
Now got to original project directory and add this newly created repo as remote
git remote add <anyName> <pathToTheRemoteRepo>
And now push the project into the remote repo:
git push <remoteRepoName> master
Here master is the name of the branch only needed first time.
Now lets check how to fetch the changes:
git fetch <remote repo name>
and to apply these changes in the working copy
git rebase <remoteRepoName/master>