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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:48:18+00:00 2026-06-05T19:48:18+00:00

I am trying to get specific version in git and commit it as the

  • 0

I am trying to get specific version in git and commit it as the current version. Consider this example scenario:

tag : v2 (current version)
files : 1.txt,2.txt,3.txt

tag : v1
files : 55.xml,33.yml

I am trying to switch to tag v1 and make it as my current version (get this specific version)

By searching web, i could able to find out way to get all the files

git checkout tag_name
# ex. git checkout v1

And this actually fetches the files from the specific version and loads into my working directory.

But i cannot commit the existing files and push it back to server.

(When it try to push, it shows like no changes pending)

  • 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-05T19:48:20+00:00Added an answer on June 5, 2026 at 7:48 pm

    It shows no changes pending because there are no changes. If you want master on the remote to point to v1, you can do an update-ref or a reset on the remote. If you want to create a new commit which is a child of v2 that has the same tree as v1, you could do a merge. What exactly is it that you want to do? Is the remote a bare repo, or is it a working directory? If the former, you should do nothing and anyone who wants to see the files at v1 should checkout v1. If the latter, you should simply checkout v1 on the remote but make no new commits.

    From your comments, it sounds like you want to make a new commit to the remote repo which has the same file content as the tag v1. It really is best to simply use update-ref on the remote repo to reset it back to v1, but it is certainly possible to make a new commit. One approach is:

    git reset $( echo 'Resetting repo to v1' | git commit-tree $(
        git show -s --format='%T' v1 ) -p v2 )
    

    This computes the tree of v1, invokes commit-tree with that argument to create a new commit object whose parent is v2 (or use HEAD, or whatever you want to be the parent of the new commit) using the commit log “Resetting repo to v1” and then resets the repo so that HEAD points to the new commit. After doing this, you should be able to push to the repo. It might be simpler to just do a pull and merge in the old tree, but that may require a fair bit of manual intervention resolving conflicts.

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

Sidebar

Related Questions

I'm trying to get the version number of a specific few modules that I
I'm trying to get a pointer to a specific version of an overloaded member
I'm trying to get a specific value from a mysql_fletch_assoc array. I explain. Here
Im trying to get some checkbox with a specific name document.getElementsByName(test); Unfortunatley i cant
I am trying to get a list of shares on a specific machine. So
I'm trying to get a custom handler to work for a specific URL (or
I'm trying to get the .Left property of a specific tab page in a
I'm trying to get the source attribute of all images withing a specific div
I am trying to get a list of elements with a specific xsd type
I'm trying to get a compile command (rake cucumber) to run with a specific

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.