What does the commit object contain? Commit object contain the following components: It contains a set of files, representing the state of a project at a given point of time reference to parent commit objects An SHAI name, a 40-character string that uniquely identifies the commit object (also called as hash). Explain the difference between git pull and git fetch? Git pull command basically pulls any new changes or commits from a branch from your central repository and updates your target branch in your local repository. Git fetch is also used for the same purpose, but it‘s slightly different from Git pull. When you trigger a git fetch, it pulls all new commits from the desired branch and stores it in a new branch in your local repository. If we want to reflect these changes in your target branch, git fetch must be followed with a git merge. Our target branch will only be updated after merging the target branch and fetched branch. Just to make it easy for us, remember the equation below: Git pull = git fetch + git merge How do we know in Git if a branch has already been merged into master? git branch –merged The above command lists the branches that have been merged into the current branch. git branch –no-merged This command lists the branches that have not been merged. What is „Staging Area‟ or „Index‟ in GIT? Before committing a file, it must be formatted and reviewed in an intermediate area known as ‗Staging Area‘ or ‗Indexing Area‘. #git add What is Git Stash? Let‘s say you‘ve been working on part of your project, things are in a messy state and you want to switch branches for some time to work on something else. The problem is, you don‘t want to commit your half-done work just, so you can get back to this point later. The answer to this issue is Git stash. Git Stashing takes your working directory, that is, your modified tracked files and staged changes and saves it on a stack of unfinished changes that you can reapply at any time. What is Git stash drop? Git ‗stash drop‘ command is basically used to remove the stashed item. It will basically remove the last added stash item by default, and it can also remove a specific item if you include it as an argument. I have provided an example below: If you want to remove any particular stash item from the list of stashed items you can use the below commands:
What does the commit object contain?
Commit object contain the following components:
It contains a set of files, representing the state of a project at a given point of time reference to
parent commit objects
An SHAI name, a 40-character string that uniquely identifies the commit object (also called as
hash).
Explain the difference between git pull and git fetch?
Git pull command basically pulls any new changes or commits from a branch from your central
repository and updates your target branch in your local repository.
Git fetch is also used for the same purpose, but it‘s slightly different from Git pull. When you
trigger a git fetch, it pulls all new commits from the desired branch and stores it in a new branch
in your local repository. If we want to reflect these changes in your target branch, git fetch must
be followed with a git merge. Our target branch will only be updated after merging the target
branch and fetched branch. Just to make it easy for us, remember the equation below:
Git pull = git fetch + git merge
How do we know in Git if a branch has already been merged
into master?
git branch –merged
The above command lists the branches that have been merged into the current branch.
git branch –no-merged
This command lists the branches that have not been merged.
What is „Staging Area‟ or „Index‟ in GIT?
Before committing a file, it must be formatted and reviewed in an intermediate area known as
‗Staging
Area‘ or ‗Indexing Area‘.
#git add <file_name>
What is Git Stash?
Let‘s say you‘ve been working on part of your project, things are in a messy state and you want
to switch branches for some time to work on something else. The problem is, you don‘t want to
commit your half-done work just, so you can get back to this point later. The answer to this issue
is Git stash.
Git Stashing takes your working directory, that is, your modified tracked files and staged
changes and saves it on a stack of unfinished changes that you can reapply at any time.
What is Git stash drop?
Git ‗stash drop‘ command is basically used to remove the stashed item. It will basically remove
the last added stash item by default, and it can also remove a specific item if you include it as an
argument.
I have provided an example below:
If you want to remove any particular stash item from the list of stashed items you can use the
below commands:
Comments
Post a Comment