0% found this document useful (0 votes)
42 views1 page

Git Commit

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views1 page

Git Commit

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Question: How To Migrate From Subversion To

GIT?
SubGIT is a tool for smooth and stress-free subversion to GIT migration and also a
solution
for a company-wide subversion to GIT migration that is:
It allows to make use of all GIT and subversion features.
It provides genuine stress-free migration experience.
It doesn’t require any change in the infrastructure that is already placed.
It is considered to be much better than GIT-SVN
Question: What Is Index In GIT?
The index is a single, large, binary file in under .git folder, which lists all
files in the current
branch, their sha1 checksums, time stamps and the file name. Before completing the
commits, it is formatted and reviewed in an intermediate area known as Index also
known
as the staging area.
Question: What is a bare Git repository?
A bare Git repository is a repository that is created without a Working Tree.
git init --bare
Question: WHow do you revert a commit that has
already been pushed and made public??
One or more commits can be reverted through the use of git revert. This command, in
essence, creates a new commit with patches that cancel out the changes introduced
in
specific commits.
In case the commit that needs to be reverted has already been published or changing
the
repository history is not an option, git revert can be used to revert commits.
Running the
following command will revert the last two commits:
git revert HEAD~2..HEAD
41/71
Alternatively, one can always checkout the state of a particular commit from the
past, and
commit it anew.
Question: How do you squash last N commits into a
single commit?
Squashing multiple commits into a single commit will overwrite history, and should
be done
with caution. However, this is useful when working in feature branches.
To squash the last N commits of the current branch, run the following command (with
{N}
replaced with the number of commits that you want to squash):
git rebase -i HEAD~{N}
Upon running this command, an editor will open with a list of these N commit
messages,
one per line.
Each of these lines will begin with the word “pick”. Replacing “pick” with “squash”
or “s” will
tell Git to combine the commit with the commit before it.
To combine all N commits into one, set every commit in the list to be squash except
the first
one.
Upon exiting the editor, and if no conflict arises, git rebase will allow you to
create a new
commit message for the new combined commit.

You might also like