isuckatcode
isuckatcode

Reputation: 119

How to pull everything from a specific commit?

enter image description here

I'm trying to pull everything from a specific commit im working with other people who have merged there branches that's why I want to pull from this commit how can I do that without messing up my own code? the specific commit is "merge 1" and is the highlighted one

Upvotes: 1

Views: 2292

Answers (3)

Heerbod
Heerbod

Reputation: 53

It seems, unfortunately, the only way is creating a new branch from the commit you want to pull and make the changes to the new branch.

Upvotes: 0

eftshift0
eftshift0

Reputation: 30156

Try git fetch instead of git pull so that you can get the information from the remote without messing up with your current work.

Upvotes: 0

Serge
Serge

Reputation: 12344

You can create a branch from any commit. So, knowing sha1 for your commit you can just

git branch mybranch a0fbc78

Now you have a named branch which points to your commit. from now on you can do many things. You can check it out

git checkout mybranch

you can create a worktree

git worktree add wtree-path mybranch

you can clone

git clone --single-branch --branch mybranch

you can pull it into another repo

git pull origin mybranch

These all things will not messup with your top of the tree code, assuming that you committed it before all those operations.

Upvotes: 1

Related Questions