Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

I have a local branch of a project ("configUpdate") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made into my local branch.

I've tried

git pull --rebase origin configUpdate

but it hasn't grabbed the latest changes - how can I merge the two? (also for bonus points what did I do with the pull --rebase command?)

1 Answer

0 votes
by (50.2k points)

For this question, you can do:

git fetch

git rebase origin/master

 This would help you to resolve your query.

Additional information:

git merge branchname will take new commits from the branch(branchname), and add the commits to the current branch. It can automatically add a "Merge" commit on top.

git rebase branchname takes new commits from the branch(branchname) and insert those commits  "under" your changes. 

It will modify the history of the current branch such that it is based on the tip of branchname.

git pull is similar to git fetch; git merge origin/master.

git pull --rebase and git fetch are similar; git rebase origin/master.

example:

You start working on a new feature.

when you're ready to push your changes, several commits have been pushed by other developers already.

If you use git pull, your changes will be buried by the new commits, in addition to an automatically-created merge commit.

If you use git pull --rebase instead, git will fast forward your master to upstream, then apply your changes on top.

To learn more about Git and GitHub, you can join Intellipaat's Git training.

Browse Categories

...