100% found this document useful (1 vote)
69 views

Git Basic Training: Analyst Presentation November 2008

This document provides an overview and introduction to various Git tools including TortoiseGit, Gerrit, and Jenkins. It describes what each tool is used for and its main features. TortoiseGit is a Windows interface for Git that is similar to TortoiseSVN. Gerrit allows for web-based code reviews and repository management for Git projects. Jenkins is a tool for continuous integration and automation that integrates with Git repositories. The document also covers basic Git concepts like remote repositories, fetching, pulling, pushing, rebasing, and amending commits.

Uploaded by

Yogi Raj Shakya
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
69 views

Git Basic Training: Analyst Presentation November 2008

This document provides an overview and introduction to various Git tools including TortoiseGit, Gerrit, and Jenkins. It describes what each tool is used for and its main features. TortoiseGit is a Windows interface for Git that is similar to TortoiseSVN. Gerrit allows for web-based code reviews and repository management for Git projects. Jenkins is a tool for continuous integration and automation that integrates with Git repositories. The document also covers basic Git concepts like remote repositories, fetching, pulling, pushing, rebasing, and amending commits.

Uploaded by

Yogi Raj Shakya
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

Analyst Presentation

GIT BASIC TRAINING


Confidential Company Overview & Update
November 2008
DRAFT
November 2008
GIT
• TORTOISE GIT
• GERRIT
• JENKINS
What is Git ?
• Git is a free and open source distributed version control system.
• Allows many software developers to work on a given project
without requiring them to share a common network.
• Distributed revision control takes a peer-to-peer approach to
version control
• Each peer's working copy of the codebase is a complete repository
What is TortoiseGit ?
• TortoiseGit is a Windows Shell Interface to Git and based on
TortoiseSVN.
What is Gerrit ?
• Gerrit provides web based code review and repository
management for the Git version control system.
• It is a free, web-based team code collaboration tool.
• Software developers in a team can review each other's
modifications on their source code using a Web browser and
approve or reject those changes.
What is Jenkins ?
• Open source automation server, Jenkins provides hundreds of
plugins to support building, deploying and automating any project
(non-human part of the whole software development process).
• It is continuous integration software tool for testing and reporting
on isolated changes in a larger code base in real time, also provide
constant feedback on the status of the software.
• Because CI detects deficiencies early on in development, defects
are typically smaller, less complex and easier to resolve.
• It enables developers to find and solve defects in a code base
rapidly and to automate testing of their builds.
• Builds can be triggered by commit in a version control system, by a
cron like mechanism, by requesting a specific build URL, or after
the other builds in the queue have completed.
Git Vs SVN
• SVN uses a single central repository to serve as the communication
hub for developers,
• Collaboration takes place by passing changesets between the
developers’ working copies and the central repository.
• This is different from Git’s collaboration model, which gives every
developer their own copy of the repository, complete with its own
local history and branch structure.
• Users typically need to share a series of commits rather than a
single changeset.
• Instead of committing a changeset from a working copy to the
central repository, Git lets you share entire branches between
repositories.
Tortoise Git Options
• Pull
• Fetch
• Push
• Diff
• Diff with previous version
• Show log
• Show Reflog
• Browse Reference
• Daemon
• Revision graph
• Repo-browser
• Check for modifications
• Rebase
• Stash Save
• Bisect start
• Resolve
• Revert
• Clean-up
• Switch/Checkout
• Merge
• Create Branch
• Create Tag
• Export
• Add
• Submodule Add
• Create Patch Serial
• Apply Patch Serial
• Settings
Git Remote
• The git remote command lets you create, view, and delete connections to other
repositories.
• Create a new connection to a remote repository. After adding a remote, you’ll be
able to use <name> as a convenient shortcut for <url> in other Git commands.
• Git is designed to give each developer an entirely isolated development
environment.
• This means that information is not automatically passed back and forth between
repositories.
• Instead, developers need to manually pull upstream commits into their local
repository or manually push their local commits back up to the central repository.
When you clone a repository with git clone, it automatically creates a remote
connection called origin pointing back to the cloned repository.
• Two of the easiest ways to access a remote repo are via the HTTP and the SSH
protocols.
• HTTP is an easy way to allow anonymous, read-only access to a repository.
• But, it’s generally not possible to push commits to an HTTP address .
• You’ll need a valid SSH account on the host machine, but other than that, Git
supports authenticated access via SSH out of the box.
Fetch
• The git fetch command imports commits from a remote repository into your local repository.
• The resulting commits are stored as remote branches instead of the normal local branches
that we’ve been working with.
• This gives you a chance to review changes before integrating them into your copy of the
project.
• Fetch all of the branches from the repository.
• This also downloads all of the required commits and files from the other repository.
• Fetching is what you do when you want to see what everybody else has been working on.
• Since fetched content is represented as a remote branch, it has absolutely no effect on your
local development work.
• This makes fetching a safe way to review commits before integrating them with your local
repository.
• It’s similar to svn update in that it lets you see how the central history has progressed, but it
doesn’t force you to actually merge the changes into your repository.
• You can check out a remote branch just like a local one, but this puts you in a detached HEAD
state (just like checking out an old commit).
• You can think of them as read-only branches.
• If you approve the changes a remote branch contains, you can merge it into a local branch
with a normal git merge.
Pull
• Merging upstream changes into your local repository is a common
task in Git-based collaboration workflows.
• Equivalent to git fetch followed by git merge.
• Git pull rolls this into a single command i.e. fetch the specified
remote’s copy of the current branch and immediately merge it into
the local copy.
• You can think of git pull as Git's version of svn update.
Push
• Pushing is how you transfer commits from your local repository to a
remote repository.
• This has the potential to overwrite changes.
• Push the specified branch to <remote>, along with all of the necessary
commits and internal objects.
• To prevent you from overwriting commits, Git won’t let you push when it
results in a non-fast-forward merge in the destination repository.
• So, if the remote history has diverged from your history, you need to pull
the remote branch and merge it into your local one, then try pushing
again.
• The --force flag overrides this behavior and makes the remote repository’s
branch match your local one, deleting any upstream changes that may
have occurred since you last pulled.
• However, you must be absolutely certain that none of your teammates
have pulled those commits before using the --force option.
• Tags are not automatically pushed when you push a branch.
Rebase
• Rebasing is the process of moving a branch to a new base commit.
• From a content perspective, rebasing really is just moving a branch
from one commit to another.
• But internally, Git accomplishes this by creating new commits and
applying them to the specified base—it’s literally rewriting your
project history.
• The primary reason for rebasing is to maintain a linear project
history.
• Instead of blindly moving all of the commits to the new base,
interactive rebasing gives you the opportunity to alter individual
commits in the process.
Ammend
• The git commit --amend command is a convenient way to fix up the most recent
commit.
• But, amending doesn’t just alter the most recent commit—it replaces it entirely.
• Never reset commits that have been shared with other developers
Diff
• Show the difference of non committed changes.

Diff with previous version


• show last commits.

Show log
• show commits of local branch.

Show Reflog
• Show commits of remote branch.
• Git keeps track of updates to the tip of branches using a mechanism
called reflog.
• This allows you to go back to changesets even though they are not
referenced by any branch or tag.
• After rewriting history, the reflog contains information about the old
state of branches and allows you to go back to that state if necessary
.
git reflog
• Show the reflog for the local repository.
• Every time the current HEAD gets updated (by switching branches, pulling
in new changes, rewriting history or simply by adding new commits) a new
entry will be added to the reflog

Browse Reference
• Talks about browse all refs(tag, branch, remote branch, stash and so on)

Daemon
• Sometimes you want to quickly share you local repository to others
without pushing to a remote git repository.
• That's when you need to use TortoiseGit → Daemon...

Revision graph
• Need to know where branches and tags were taken from the point, and
the ideal way to view this sort of information is as a graph or tree
structure
Repo-browser
• See all contents/files of a repository, without having a working tree (e.g. a
bare repository) or you want to see all files of a revision without switching
to it.

Check for modifications


• Same as diff

Stash Save
• Save your uncommitted data.
Bisect start
• This command uses a binary search algorithm to find which commit in
your project's history introduced a bug.
• You use it by first telling it a "bad" commit that is known to contain the
bug, and a "good" commit that is known to be before the bug was
introduced.
• Then git bisect picks a commit between those two endpoints and asks you
whether the selected commit is "good" or "bad".
• It continues narrowing down the range until it finds the exact commit that
introduced the change.
• In fact, git bisect can be used to find the commit that changed any
property of your project; e.g.,
• the commit that fixed a bug, or the commit that caused a benchmark's
performance to improve.

Resolve
• To resolve conflicts
Create Branch
• Create a new branch

Create Tag
• Create a new tag you can add comments or details about commit

Export
• To export your directory to a new location.

Apply Patch Serial


• Patch files are applied to your working tree. This should be done from the
same folder level as was used to create the patch. If you are not sure what
this is, just look at the first line of the patch file. For example, if the first
file being worked on was doc/source/english/chapter1.xml and the first
line in the patch file is Index: english/chapter1.xml then you need to apply
the patch to the doc/source/ folder. However, provided you are in the
correct working tree, if you pick the wrong folder level, TortoiseGit will
notice and suggest the correct level.
Settings
• settings options to manage Git

Sync
• Sync Dialog collects all operations related with remote repository to
one dialog.
• Sync Dialog includes push, pull, fetch, remote update, submodule
update, send patch

Add
• To add new files

Submodule Add
• To add new repository
Create Patch Serial
• For open source projects everyone has read access to the (main/public)
repository, and anyone can make a contribution to the project. So how are
those contributions controlled? If just anyone could commit changes this
this central repository, the project would be permanently unstable and
probably permanently broken. In this situation the change is managed by
submitting a patch file or a pull request to the development team, who do
have write access. They can review the changes first, and then either
submit it to the main repository or reject it back to the author.
• Patch files are simply Unified-Diff files showing the differences between
your working tree and the base revision.
• Directory is output directory of patch. Patch file name will be created by
commit subject.
• Since create patch from point. You can click ... to launch refbrowse dialog
to choose branch or tag.
• Number Commits is limited how much patch will created.
• Range is choose range of from commit to to. You can click ... to launch log
dialog to choose commit.
• Send Mail after create launch send mail dialog after patches created (see
the section called “Sending patches by mail”).
Git Commit Options
Compare with working tree
• Show changes from that version of commit to your local repository

Show changes as unified diff


• Show the same as above except it shows only in a single file line by line.

Compare with previous revision


• Show changes comparing last commit.

Browse repository
• To browse through repository

Merge to "Branch_Name"
• Merge that commit to a branch.

Reset "Branch_Name" to this


• Reset current status to that commit and remove commits from your local
directory from current to that commit.
Switch/Checkout to this
• can switch branch by creating a new branch.

Create Branch at this version


• will create a new branch from commit taking as base

Create Tag at this version


• will create a new Tag from commit taking as base

Rebase "Branch_Name" onto this


• Rebase to any branch from that commit as base

Export this version


• Export complete project till that commit

Revert change by this commit


• Revert change

Edit Notes
• Edit existing notes or allows to add new one
Cherry Pick this commit
• Take change of that commit to other branch

Format Patch
• To create a patch from that commit onwards

Copy SHA-1 to clipboard


• To copy SHA(Secure Hash Algorithm)

Copy log messages to clipboard


• Copy log messages

Search log messages


• To search by commit message

Show branches this commit is on


• Show all branches where a particular commit is available.
Git Blame
To see the history of the changes in to a file.
Resolve Conflicts
• Use this text block
• Use this whole file
• Use text block from
‘mine’ before ‘theirs’
• Use text block from
‘theirs’ before ‘mine’
Git Bash
• Git Bash emulates a bash environment on windows.
• It lets you use all git features in command line plus
most of standard unix commands.
• Git Bash uses the Bash shell (Bourne Again Shell)
and MinGW, which is a port of a Linux style
environment and command line tools.
Some Useful Commands-
• git clean -f -d
Remove untracked directories in addition to untracked files.

• git clean -f -X
Use to remove ignored files.

• git clean -f -x
Use to remove ignored files and non-ignored files.

• git reset --hard origin/master


Update your local HEAD branch to be the same revision as origin/master.
Source -
https://en.wikipedia.org/wiki/Jenkins_(software)
http://searchsoftwarequality.techtarget.com/definition/Jenkins
https://www.atlassian.com/git/tutorials/rewriting-history/git-
commit--amend
https://www.derekgourlay.com/blog/git-when-to-merge-vs-
when-to-rebase
https://tortoisegit.org/docs/tortoisegit
http://p-nand-
q.com/programming/windows/git/getting_started.html
Questions?
Thanks

You might also like