FakeDeveloper
FakeDeveloper

Reputation: 33

Git: Update repository without losing commits

I'm a novice in git. I'm working on on project X. I have the following problem:

Remote

Origin -> A - B - C

BranchX -> A - B - D

Local

Origin -> A - B

BranchX -> A - B - D

How do I get commit C to BranchX in my local such that the local repo looks like this:

Local

Origin -> A - B - C

BranchX -> A - B - C - D

Upvotes: 1

Views: 125

Answers (1)

Cory Kramer
Cory Kramer

Reputation: 117856

First you make sure you have BranchX checked out

git checkout BranchX

then update your local Origin branch from remote

git fetch origin Origin:Origin

lastly rebase your BranchX onto the Origin branch

git rebase Origin

Upvotes: 1

Related Questions