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..
new_clone“, becausenew_cloneis not a branch. You have a repository with two branches, namedmasterandnew_branch. What does “switch to [repository path]” mean?git_repointo my working copy innew_clone?” The answer is you do agit fetchto retrieve the changes, andgit mergeorgit rebaseto incorporate them locally (orgit pullto do both in one operation).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, usegit log --oneline --left-right new_clone...new_branchor the like.git push, as you already did.