Git Basics
Source
control or Version control is a system which keeps a record about changes that
made for a file or many files along the time so that we can recall it when
needed
Version
control is of two types as
·
Centralized
version control (CVCS)
§
Developers
interact with a central VCS server
§
Interaction
is very slow
§
Not
supportive to GitHub, GitLab, BitBucket
·
Distributed
version control(DVCS)
§
Developers
can have a local version database and interact with a server computer and each
other
§
Collaborative
working is allowed
§
Branching
workflows for projects are supported
Git
is replacement of BitKeeper which is introduced by Linus Torvalds in 2005.
Features
of Git
§ Speed is high even with large projects
§ Can have multiple branches for
parallel workings
§ Distributed version control (DVCS)
§ Supportive to GitHub, GitLab,
BitBucket
§ Has Integrity
§ Has 3 common states as Modified to
Staged and Staged to Committed
Advantages of Git
§ Keep a track on the changes made for
files
§ Keep history of the codes
§ Collaborative workings are allowed
§ Localize the personal work until it is
shared to teammates
§ Can resolve issues easily
§ Can inspect the previous project if
necessary
Commands
to add an existing repository to GitHub
1.
Create a new
repository on GitHub.
2.
Open command prompt in
your local project.
3.
Remove unwanted
existing Git components
rd .git /S/Q
4.
Initialize the local
directory as a Git repository.
git init
git init
5.
Add the files in your
new local repository.
git add .
git add .
6.
Commit the files that
you’ve staged in your local repository.
git commit -m "<Any appropriate word>"
git commit -m "<Any appropriate word>"
7.
Add the URL for the
remote repository where your local repository will be pushed.
git remote add origin <repository URL>
git remote add origin <repository URL>
8.
Push the changes
in your local repository to GitHub.
git push -u origin master
git push -u origin master
Comments
Post a Comment