Git Sheet
Git Sheet
What is Git?
‘’Git’’ is a go-to-version control tool that allows developers to access all of the code and
efficiently manage their source code and track file changes be it small, medium, or
massive application development. It remains the most widely used open-source
distributed version control system (DVCS) till date.
-> All developers code should be store at one place (Code Integration Should
Happen) .
-> To integrate all the developers source code at one place we will use
Sourcecode Repository Softwares.
1) All the developers can connect to repository server and can integrate the
code.
- Who
- When
- Why
– What.
•Git is used to tracking changes in the source code hence tracks history
•Git is a distributed version control tool for source code management. It is free and
open-source.
•Git creates backup automatically, as the developer has a version of the code on the local
repository.
•Git allows multiple developers to work together; hence is scalable and supports
collaboration.
3) Once installation completed, right click on the mouse and verify git options display (If
git options displaying our git client installation completed successfully).
-> Create Repository in github Note: Repository is used to store project source code.
Every Project will have one repository
-> When we create a repository, unique URL will be generated with Repository Name (i.e
Repo URL)
-> All the developers will connect to repository using Repository URL
1) public repository
2) private repository
-> Public Repository :- means everybody can access but we can choose who can modify
our repository
-> Private Repository :-means we will choose who can access and who can modify.
-> Git Bash we can use as Git Client software to perform Git Operations
-> Right Click on Mouse and choose "Open Git Bash Here"
git help : It will display frequently used git commands git help
$git pull:- this command is used to take code from our repository.
$ git status : It will display staged , un-staged and un-tracked files Syntax :
Un-Staged Files : The files which are modified but not added for commit
Un-tracked files : Newly created files Note: To commit a file(s), we should add
to staging area first how to unstaged files from staging area
$ git add .
$ git push : To push changes from git local repository to git central repository
1) Create one public repository in git hub (take github repo url)
2) Clone github repository using 'git clone' command $ git clone 'repo-url'
6) Add file to staging area using 'git add' command $ git add .
8) Push file from git local repository to git central repository using 'git push'
command $ git push
Branches
> Branches are used to maintain seperate code bases for our project
You can decide how to group the changes to create meaningful commits.
$ git branch