Skip to content

Instantly share code, notes, and snippets.

@vinothkannans
Last active March 1, 2024 02:20
Show Gist options
  • Select an option

  • Save vinothkannans/323898332ab571d80b1eeb6a037fa2ad to your computer and use it in GitHub Desktop.

Select an option

Save vinothkannans/323898332ab571d80b1eeb6a037fa2ad to your computer and use it in GitHub Desktop.
Syncing a fork or clone without history of remote commits
  • First fork or clone your remote git project
  • Delete existing history and commits by deleting .git folder
  • Add remote git project as upstream
  • Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master.
git fetch upstream
  • Check out your local master branch.
git checkout master
  • Merge the changes from upstream/master into your local master branch. This brings your master branch into sync with the upstream repository, without losing your local changes.
git merge --allow-unrelated-histories --squash upstream/master
@AkeEvoX

AkeEvoX commented Apr 23, 2021

Copy link
Copy Markdown

not work for gitlap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment