Test PDF
Test PDF
Developer Developer
Who is a Cowboy Coder ?
Solution 1
Developer has to search all his emails with the client conversation
Challenge 2
Project has multiple file changes to achieve the feature
Solution 2
Keep the backup of full project by zipping it with time stamps
Best solution is a System to …
project
v.3 v.4
v.1
v.2
v.2 v.5
v.3
v.4
v.1 v.6
v.5
v.6
created deleted
modified
Which VCS to use ?
linux ( on terminal )
$ git --version
git version 2.6.4
linux
$ sudo yum install git
or:
$ sudo apt-get install git
windows
http://msysgit.github.io/
or:
http://git-scm.com/download/win
How to re-verify that git is installed ?
mac ( on terminal )
$ git --version
git version 2.6.4
linux ( on terminal )
$ git --version
git version 2.6.4
my_repo
config
.. . .git
objects
Delete a Repository of a working dir
$ rm –r my_repo/.git
my_repo
.. .
Quiz
Suppose your home directory /home/repl contains a repo dental, which has a sub
directory data. Where is the information about the history of the files in /home/repl/
dental/data stored ?
/home/repl/.git
/home/repl/dental/.git
/home/repl/dental/data/.git
/home/repl/.git
/home/repl/dental/.git
/home/repl/dental/data/.git
use the "$git status" command to get a list of all the changes you
performed since the last commit
Golden rule of VCS !!
$ git status
untracked staged
$ git log
Whats the first steps in saving the change
$ touch README.txt
( $ git status )
( $ git status )
How do I commit changes ?
(Empty dir)
my_repo
$ git init
Master
branch
my_repo .git
$ touch README.txt
README.txt
Master
branch
my_repo .git
$ git add README.txt
add
README.txt README.txt
Master
branch
my_repo .git
How can I check the state of the repo?
add
git status
README.txt README.txt
Master
branch
my_repo .git
$ git commit –m “First commit”
add commit
Master
branch
my_repo .git
How can I tell what I have changed ?
add commit
Master
branch
my_repo .git
$ git diff AND git diff --staged
add commit
git diff
git diff --staged
Master
branch
my_repo .git
What is in diff command ?
current
previous version
version
diff --git a/README.txt b/README.txt
removed index e713b17..4c0742a 100644
——— a/README.txt
added
+++ b/README.txt
line @@ -1,4 +1,4 @@
number -# This is the first line
+# This is the first line rewritten
deletion
addition
How can I view a specific file history ?
$ notepad README.txt
$ git add .
Or
Master
branch
my_repo .git
$ notepad README.txt
Master
branch
my_repo .git
$ git add .
Master
branch
my_repo .git
$ git commit –m “Second commit”
Master
branch
my_repo .git
hands-on for second
commit
Summary of commands
add commit
master
ls git ls-files git show --name-only
and then
$ git checkout HEAD path/to/file
This brings the file from staging area to the working directory
this is undoing the changes
Messed working (staged and commit)
Careful: this overwrites changes to files in your working area and staging area
HEAD~1 can also be used
the act of restoring the file is saved as another commit, because you might later want to undo your undoing.
My Laptop got
crashed/stolen
Solution !!
Working with
Remote Repo
on cloud to backup and
share with other
developers
Github/Bitbucket
$ git remote –v
To show your remotes for repo
$ git remote show origin
to show your remote named origin
$ git remote add name/of/remote https/path/to/repo
you can connect to many remotes as you like
$ cd ~/Documents
on your new laptop
clone/pull