Home > Software design >  how to sync my cloned repository with the original remote repo?
how to sync my cloned repository with the original remote repo?

Time:11-03

Git newbie here!

I, Allison, have just cloned a repository (the_repo) from Bob.

I made some changes to the the_repo and I wish to make a pull request so Bob can merge the changes I made.

However, Bob made some changes after I cloned his the_repo and I would like to make sure that all changes that were made by Bob are now synced with mine.

I can I do so from git bash?

When I do, git pull - it obviously pull the changes under my account. Is this called rebase?

CodePudding user response:

the git pull is two combined commands git fetch and git merge

So, basically, you are doing a merge operation

To do a rebase you can use git pull --rebase

CodePudding user response:

With a repository already cloned, if anybody may be making changes in the remote, you can simply type git pull followed by the name of the branch, cheking for new changes and download them:

$ git pull origin master 

Then you will have a new remote branch with your changes, to check the current remotes type:

$ git branch --all

remotes/origin/HEAD -> origin/master
remotes/origin/master

NOTE: If you or another person are modifying the same line of the same file, git may need to do a recursive strategy and you will have to solve a conflict first.

CodePudding user response:

ok I got it:

I needed to do:

1. $ git remote add bobs_work [email protected]:XXXX/the_repo.git
2. $ git fetch bobs_work
3. $ git rebase bobs_work/master
  • Related