0 votes
15 views

 What is the use of Staging area or Indexing in Git?

in Technology by (191k points)

1 Answer

0 votes
Git pull command pulls all new commits from a specific branch in the central repository and makes the target branch in your local repository up-to-date.

Git fetch also aims at the same thing, however, its underlying functionality is a bit different. When you do a git fetch, all the new commits from a specific branch will be pulled in your central repository and these changes will be stored in a new branch in your local repository. This is called a fetched branch.

If you wish to see these changes in your target branch, then you need to perform a git merge after git fetch. The target branch will be updated with the latest changes only after merging it with the fetched branch.

So, a git pull brings the local branch up-to-date with its remote version, whereas a git fetch does not directly change your own local branch or working copy under refs/heads. Git fetch can be used to update your remote-tracking branches under refs/remotes/<remote>/.

In simple words, git pull is equal to git fetch followed by a git merge.
by (191k points)

Related questions

0 votes
1 answer 11 views
11 views asked Nov 4, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 16 views
16 views asked Nov 2, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 22 views
0 votes
1 answer 16 views
16 views asked Nov 4, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 28 views
28 views asked Nov 4, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 24 views
0 votes
1 answer 22 views
0 votes
1 answer 32 views
0 votes
1 answer 33 views
0 votes
1 answer 20 views
20 views asked Nov 4, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 21 views
0 votes
1 answer 30 views
+1 vote
1 answer 18 views
0 votes
1 answer 37 views
37 views asked Jan 8 in Technology by JackTerrance (191k points)
0 votes
1 answer 25 views
0 votes
1 answer 21 views
0 votes
1 answer 11 views
11 views asked Nov 4, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 23 views
0 votes
1 answer 32 views
32 views asked Jan 8 in Technology by JackTerrance (191k points)
0 votes
1 answer 67 views
67 views asked Dec 10, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 12 views
12 views asked Nov 4, 2020 in Technology by JackTerrance (191k points)
0 votes
1 answer 15 views
15 views asked Nov 4, 2020 in Technology by JackTerrance (191k points)
...