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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:04:35+00:00 2026-06-07T05:04:35+00:00

I am working on a local branch VISS . Then I decided to check

  • 0

I am working on a local branch VISS. Then I decided to check out a previous commit:

git checkout 98ea3c8042c39e

I made some important changes to the code. and then I committed again.

Now I need to go back to my branch VISS keeping these changes.

What should I do if I want to:

  1. Go back to my VISS branch discarding what was done before checking out to a previous commit (98ea3c8042c39e).

  2. Go back to my VISS branch merging the new changes with what I had done on the top of the VISS.

  • 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-07T05:04:37+00:00Added an answer on June 7, 2026 at 5:04 am
    1. Go back to your branch and discard everything :

      git checkout VISS
      

      Your new commit atop 98ea3c will be left floating in the middle of nowhere, and will eventually be garbage collected by git.

      Conversely, if you are willing to make 98ea3c the top of VISS and discard what VISS is currently pointing to, do the following:

      git checkout VISS
      git reset --hard 98ea3c
      
    2. Go back to VISS and merge your new changes on the top of it:

      # On the new commit you just made:
      git rebase VISS
      
      # Now take note of what the commit ID is.  Assume I got "abc123"; then:
      git checkout VISS
      git merge abc123
      

      You’ll now have VISS with the change as the latest commit, and no merge commit.

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

Sidebar

Related Questions

Say I have an arbitrary local git working directory that was cloned from some
I have master branch (It is working copy), then some point in time I
I have checked out now a local working copy of a codebase that lives
I accidentially discard my changes on files in my local working tree via git
I'm working with some local json files but I'm having some problems with the
Here's my scenario: I'm working on fixing bugs in file1 in a local branch.
I have a local branch that is tracking of a remote branch on git.
I've been working on a local clone of a remote git repository, committing my
If a working copy (local copy) was created from a branch, lets call it
Scenario: Local git repo, default master branch FTP server with content of the repo

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.