2022-06-25 11:40:44 +02:00
|
|
|
---
|
|
|
|
title: Git
|
2022-11-19 15:25:20 +01:00
|
|
|
visible: true
|
2022-06-25 11:40:44 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
[toc]
|
|
|
|
## Reset everything to selected branch
|
|
|
|
Useful for getting to the same state as upstream
|
|
|
|
`git reset --hard (upstream)/(branch)`
|
|
|
|
`git pull (upstream) (branch)`
|
|
|
|
|
|
|
|
Finally force push all of this into your own repo
|
|
|
|
|
|
|
|
## Get Pull Request from foreign repo
|
|
|
|
*Example with neofetch*
|
|
|
|
|
|
|
|
Add remote if you haven't already done that
|
|
|
|
`git remote add dylanaraps https://github.com/dylanaraps/neofetch.git`
|
|
|
|
|
|
|
|
Remotes can be show with `git remote show`
|
|
|
|
|
|
|
|
Fetch desired commits
|
|
|
|
`git fetch dylanaraps a0221c51ff4c8ce834d7e3431f2770b6879de009`
|
|
|
|
|
|
|
|
Cherry pick commits
|
|
|
|
`git cherry-pick -m 1 a0221c51ff4c8ce834d7e3431f2770b6879de009`
|
|
|
|
|
2022-11-19 15:25:20 +01:00
|
|
|
Resolve whatever conflicts arise
|