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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:10:29+00:00 2026-06-12T03:10:29+00:00

Suppose that I create an empty GIT repo with the following command: # git

  • 0

Suppose that I create an empty GIT repo with the following command:

# git init

Then I start adding remote repositories:

# git remote add remote1 ........
# git remote add remote2 ........
# git remote add remote3 ........

and fetching:

# git fetch --all

Finally, I merge into my local repo all the remote branches that I need:

# git merge remote1/branchX
# git merge remote2/branchY
# git merge remote3/branchZ

Now, suppose I have to reset my local repo at before all the merges; the natural solution seems to be to just create a new empty repository. But the problem is: the fetch of my remote repositories takes a very long time (hours), so I would like to avoid to re-fecth all again.

I cannot do a “git reset” because I do not have a commit preceeding all the merges.

  • 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-06-12T03:10:31+00:00Added an answer on June 12, 2026 at 3:10 am

    A decent way to cheat this is to do a git init && git commit --allow-empty -m 'Initial commit.' when you set up the repository, which alleviates the symptom of a non-existent HEAD at least.

    But since you’ve fetched all of the remotes already, you do not need to blow away the repository in order to create a new empty/unrelated branch if that’s more what you’re looking for:

    git symbolic-ref HEAD refs/heads/new-branch
    

    Then when you commit/merge whatever on HEAD, git will fill in the new branch for you. Once you have another existing branch you can hard reset master or do whatever other tricks you’d like to juggle them around.

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

Sidebar

Related Questions

Suppose that we have following tables create table Employee( 2 EMPNO NUMBER(3), 3 ENAME
Suppose I create a Windows Azure application that consists of multiple instances talking to
Suppose I am designing a class that can handle any database technology to create
I understand that we need to create MXML file to define a view. Suppose
Suppose we start from scratch in Visual Studio 2010 and add a 'WCF Service
Suppose that i have a city that has many buildings. I want to create
I want create a web application that display a list of items. Suppose I
Suppose you have a String[] that has been created after a .split() which then
Suppose I have the following requirement: Add the element e to the element with
Supose I have a matrix. This matrix is blank except some points that create

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.