Version Control System (1)
Version Control System (1)
Why it is useful ?
● Collaboration
● Storing versions (Properly)
● Restoring Previous versions
● Understanding what happened
● Backup
Types of Version Control System
● GitHub
● Bitbucket
● GitLab
Git
● In Git you can commit changes, create branches , view
logs, etc. when you are offline.
● You require network connection only to publish your
changes and take the latest changes.
Advantages of Git
● Fast and small
● Implicit backup
● Security
● No need of powerful hardware
● Easier branching
Installation
Windows: Download
Getting Start to work with git
Step 1
$ mkdir <folderName>
• Use the git status command to see which files”git knows exist.
$ git status
Step 4
● Add a file to a commit, you first need to add it to the staging environment.
$ add . or git add <newFolderName> then git add <filename>
Step 5
Step 7
one developer deleted a file while another developer was modifying it.
• Conflicts only affect the developer conducting the merge, the rest of the team is
• Git will mark the file as being conflicted and halt the merging process.
● All the content between the center and the <<<<<<< HEAD line is content that exists
in the current branch master which the HEAD ref is pointing to.
Note:
stash is local to your Git repository; stashes are not transferred to the server
when you push.
Git stash
● Re-applying your stashed changes
$ git stash pop
Popping your stash removes the changes from your stash and re-applies them to
your working copy.
.$ git stash apply
This is useful if you want to apply the same stashed changes to multiple branches
Git stash
● Stashing untracked or ignored files
$ git stash -u
tells git stash to also stash your untracked files.
.$ git stash -a
tells git stash to also stash your ignored files.
Git stash
● Managing multiple stashes
$ git stash list
View multiple stashes on top of the branch.
$ git stash save "message"
Annotate the stash with description.
$ git stash pop stash_identifier
re-apply the given stash into the current working copy
Git stash
● Viewing stash diffs
$ git stash show
View a summary of a stash.
$ git stash show -p
View the full difference of the stash.
Git stash
● Creating a branch from your stash
$ git stash branch
Git stash
● Clean up your stash
$ git stash clear
Delete all of your stashes.