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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:50:46+00:00 2026-06-15T23:50:46+00:00

I am a very basic git user; I basically only use the commands git

  • 0

I am a very basic git user; I basically only use the commands git add -a (to add files after modifying them) and then git commit -m "what I did" and then git push (to push it to my server).

Now I want to do something very drastic to my codebase. Something that might possibly not work — and I will have to revert back to where I was.

How do I do that? Do I create a “branch”? Or a tag? Or something else?

I am after a set of simple commands with simple explanations. also to then return to the original HEAD, or to then (maybe) merge the changes into HEAD (which won’t have changed)

Merc.

  • 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-15T23:50:47+00:00Added an answer on June 15, 2026 at 11:50 pm

    You need a branch.

    git checkout -b nameofyournewbranch
    

    This checks out your current branch (default name is ‘master’) as a new branch with the name you specify. Any commits you do now will be on the new branch. If you want to leave it and go back to where you were:

    git checkout master
    

    to go back to your new branch:

    git checkout nameofyournewbranch
    

    if you want to merge your branch into your main codebase:

    git checkout master
    git merge --no-ff nameofyourbranch 
    

    –no-ff means you will see it branch out of master and then branch back in, allowing you to keep track of separate features.

    To see what you’re doing, get a git source tree viewer of some sort e.g. source tree, gitk etc. Much easier to understand what the branches are doing if you can see them visually.

    Update:
    To check what would happen before merging, make a temporary branch in the same place as master and merge to there:

    git checkout -b tempbranchname master
    git merge --no-ff nameofyourbranch
    

    If you like it, merge it to master and it’ll be as if you did it on master in the first place:

    git checkout master
    git merge tempbranchname
    

    If you don’t, just delete it:

    git checkout master
    git branch -D tempbranchname 
    

    -D means delete even if not merged to master. Use -d normally as you’ll get a warning if you try to delete unmerged stuff that you would lose.

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

Sidebar

Related Questions

I have only a very basic knowledge of SQL, so pls do forgive if
Very basic, But I don't know, How to add JSoup.jar to my android workspace?
The very basic issue all developers face: Whenever user submits the form, the password
Very basic question, but I have an error in my code that can only
I am trying to learn Git at a very basic level from this tutorial
Very basic question - but I couldn't find an answer. I have got a
Very basic question - how to get one value from a generator in Python?
Very basic question- I've a xml file and I want to validate it against
A very basic question in excel. I have a column with valid and with
A very basic question.. but I always do the bad implementation of this. I

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.