Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 331175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:45:00+00:00 2026-05-12T09:45:00+00:00

I started a local git repository. Now, at this point, I want to publish

  • 0

I started a local git repository. Now, at this point, I want to publish it, say to github, but I don’t want to publish the whole history of the project, just the latest revision.

In particular, I’d like to create a local “pub” branch, make some modification on it (possibly hiding sensitive information), and the publishing the “pub” branch.

If I were to do what I said using a plain push, I’ll find myself having all the “pub” history published to the remote repository, something I don’t want since sensitive information would be published too.

How can this be achieved?

Thanks!

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:45:00+00:00Added an answer on May 12, 2026 at 9:45 am

    Take a look at this question.

    You could also just swap out the .git folder in your source tree with a different one, and check your code into that when you want to publish.

    You can not, however, set up a branch in the same Git repository without sharing the history, because of the way Git works. A repository has a root commit of the initial state, and all other commits are simply deltas against that commit.

    But while we are at it, if you don’t want to expose version control history, why not simply publish the code as a tarball with a version number, no reason to drag Git into it 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I set up a rails app on a laptop, and started local git repository
I want to add local svn or git repository to my code in Xcode
EDIT: This is solved now but I don't have enough rep to answer it
I'm just getting started with Git. I've got: a repository on my local machine
I'm trying to get started using git, but I'm having some troubles right away.
I just started working on a project that uses git as a repository. I've
This gives a good explanation of squashing multiple commits: http://git-scm.com/book/en/Git-Branching-Rebasing but it does not
I have a local thread that is started on button-click event from the main
I have started a new mvc project and clicked on project\properties\web - use local
Started with this question: OpenID. How do you logout OK. So OpenID does not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.