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 6068641
In Process

The Archive Base Latest Questions

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

I’m new to git. I have remote git repo on my server which contains

  • 0

I’m new to git. I have remote git repo on my server which contains master which is the current version of my code. On my local computer I have old versions (about 10) of this code just stored elsewhere from before I was using version control (just plain files).

Even though I probably will never need the old versions again, I’d still like to add them to the repo so if I ever wanted to check an old version I could do that.

So how do I do this, do I add them as branches or tags and how should I go about adding them to the remote repo?

Right now I do this: just delete ALL the current version code (already committed and pushed to server), copy and paste in the old code files (say version 0.2) and create new branch (version0.2), commit that and then push to server. Now I got 2 branches, master and version0.2. Should this be the correct way?

  • 1 1 Answer
  • 0 Views
  • 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-23T09:44:13+00:00Added an answer on May 23, 2026 at 9:44 am

    Your system is fine, however if the old code actually lead to where master is I’d recommend stitching everything together into a single branch once all the code is in the repository. I’m assuming that this is a private repository and messing with master isn’t going to effect anybody else (rewriting history on a public repository isn’t nice).

    That being said I also assume you have a bunch of branches similar to the following branches:

    1. v0.1
    2. v0.2
    3. v0.3
    4. master

    In this case v0.1 is the oldest, v0.2 built on v0.1, and so on. To actually make master represent this I suggest rebasing branches in order so that at the end master contains the code from all the branches. The steps to do this are:

    1. git checkout v0.2
    2. git checkout -b REBASE_v0.2
      • By creating a new branch, named REBASE, here we don’t effect the original v0.2 branch. If something goes wrong we can always revert to the old branch.
    3. git rebase v0.1
    4. Solve any conflicts.
    5. If you removed any files between v0.1 and v0.2 git rm FILE each file.
    6. git checkout v0.3
    7. git checkout -b REBASE_v0.3
    8. git rebase REBASE_v0.2
    9. Solve any conflicts
    10. If you removed any files between v0.2 and v0.3 git rm FILE each file.
    11. Rinse and repeat steps 6-10 for any more version branches you’ve imported.
    12. git checkout master
    13. git checkout -b REBASE_master
    14. git rebase REBASE_v0.3
    15. Solve any conflicts
    16. git diff master
      • Assuming all conflicts were resolved correctly this should show no differences.
    17. git checkout master
    18. git branch master_old
    19. git reset --hard REBASE_master
    20. git branch -D REBASE_v0.2 REBASE_v0.3 REBASE_master
      • Get rid of the rebase branches

    Once you’re certain that everything is good you can go ahead and get rid of original branches: git branch -D v0.1 v0.2 v0.3 master_old

    At this point you should just have a master branch with your actual code progression.

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

Sidebar

Related Questions

I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.