0

How can I separate git commits / git history from personal (private) and public. I have several computers and I often switch between them. In order to have the latest code available I very often do commits on one computer, and then pull it on another computer. This causes a very ugly commit history, which doesn't make sense, and therefore I don't want these commits to be in the history when I push a new version to a public git repository. What is the correct approach here?

2
  • 2
    First approach: don't worry about it, no one else does. Alternatively: rebase interactively and squash/rearrange/retitle your commits as desired before pushing to public.. Note that the second one implies rewriting the history which has some annoying side effects. Commented Dec 14, 2023 at 9:29
  • Interactive rebasing and squashing commits is completely fine, but be cautious with rewriting history if your commits are already pushed to a shared repository. It can cause issues for others who have pulled the original history Commented Dec 14, 2023 at 9:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.