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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:35:52+00:00 2026-05-29T12:35:52+00:00

I am tryin gto understand branches in git.I have worked with SVN so trying

  • 0

I am tryin gto understand branches in git.I have worked with SVN so trying to get the directory structures

i create a git main repo with

mkdir git_repo
cd git_repo
git init --bare
cd ../
git clone git_repo new_clone
cd new_clone
touch test.txt
git add test.txt
git commit test.txt
git push origin master
//So now the contents are in git_repo
git branch new_branch
git branch 
/*master
*new_branch is the output */
git checkout new_branch
//Switched to branch 'new'

My question is that

1.How to switch back to new_clone

2.how to push files to new_repo from the branch

3.How can i see the diff in files beteen the new_branch and new_clone

4.How can i push the files to git_repo

5.When i do use merge in this case

6.How to list the files in new_branch and new_clone separately

Can any one please explain these with the examples.

Thanks..

  • 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-29T12:35:53+00:00Added an answer on May 29, 2026 at 12:35 pm
    1. You cannot “switch back to new_clone“, because new_clone is not a branch. You have a repository with two branches, named master and new_branch. What does “switch to [repository path]” mean?
    2. I think what you mean to ask here is “how do I retrieve commits made to git_repo into my working copy in new_clone?” The answer is you do a git fetch to retrieve the changes, and git merge or git rebase to incorporate them locally (or git pull to do both in one operation).
    3. git diff new_branch new_clone. For a particular file, git diff new_branch:path/to/file new_clone:path/to/file. For the diff in terms of changesets, not patch format, use git log --oneline --left-right new_clone...new_branch or the like.
    4. git push, as you already did.
    5. Use merge when you want to incorporate one branch’s changes and history into another branch. Merging is a very powerful concept, but you should already be familiar with the basic idea from SVN – git tends to work better, though, because it takes better account of shared ancestry between the revisions to be merged even in a 2-way.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand if I really have any case for using git/mercurial.
Trying to understand something. I created a d:\svn\repository on my server. I committed folders
Just trying to understand that - I have never used it before. How is
I'm trying to understand if it's possible to create a set of variables that
From what I understand of subversion if you have a repo that contains multiple
Trying to understand, why my C++/Qt application creates 18 threads, while i don't create
Trying to understand what Sql Profiler means by emitting sp_reset_connection. I have the following,
Trying to understand radix sort for my data structures class. My teacher showed us
trying to understand how custom admin commands work, I have my project named mailing
Hi I'm new to svn and am trying to get the hang of the

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.