Ok, so lets contextualize ourselves
- Let's say you have a main repo A which could be an open source project or a company project
- Project A served as blueprint for your next project, B. So you either forked or cloned A and removed the .git folder to have a clean git history
- You start working on project B as you would normally do
Now... at some point A changes and you want to pull those changes to B without getting the entire commit history. Maybe there's only 1 commit, maybe there's thousands.
Here's what you can do.
Open up a terminal and follow the steps:
# cd into your repo and change to the branch you want to merge the pull the changes into
$ git remote add <remote_alias> <remote_url>
$ git pull <remote_alias> <name_of_the_branch> --allow-unrelated-histories --no-tags
$ git reset HEAD
# Solve any conflicts
$ git add .
$ git commit -m "Your message here"
# Check your log to verify. You should see only the project B commits
$ git log
You could remove the added remote
$ git remote remove <remote_alias>
You can run the following command to check for any local undesired tags
$ git tag
$ git tag --delete <tag_name>