user8238012
user8238012

Reputation:

Git synchro with remote

I got a local sandbox branch and a remote sandbox branch.

But, my local sandbox isn't very clean. I might have 41 commits late, and 10 in advance.

I want to wipe out all my commits in advance to be able to pull the remote sandbox without any merge commit.

Should I go for a git pull with some option or the hard way and reset head by 10 commits ?

Thanks

Upvotes: 1

Views: 119

Answers (1)

Sajib Khan
Sajib Khan

Reputation: 24194

You can do hard reset by origin/sandbox then, local sandbox will be replaced with origin/sandbox.

$ git fetch
$ git reset --hard origin/sandbox

Or, discard last 10 commits of local sandbox then, Pull origin/sandbox to get the latest commits (41 commits) of remote sandbox.

$ git reset --hard HEAD~10
$ git pull origin sandbox

Upvotes: 1

Related Questions