0

I am trying to work with GIT, without creating private branches.

What that means is I directly work on my cloned repository (master)

Now, Is that the right way to use GIT? I run into many issues related to updating my repository (GIT PULL / GIT FETCH). And most of the time, I am not able to use GIT Merge.

Is there a particular way in which i can use GIT MERGE, GIT PULL, and GIT FETCH. That will help me?

Looks like the best way to work with GIT is have branches.

Branch 1 GIT Commit GIT PUSH GIT MERGE master ( to fetch the newer changes)

Branch 2 GIT Commit GIT PUSH

master GIT Merge branch1 GIT Merge branch2

I dont think there any other way. Please correct me if i am wrong?

Nida Sahar
  • 698
  • 4
  • 13
  • 29
  • 1
    What you are doing goes against the way git is expected to be used. The idea behind git is that everyone has a copy of the entire repo. When you do a commit it goes into your local copy of the repo anyway and then that gets pushed. What are you trying to achieve? Why can't you use git by "creating private branches"? – Dale Myers Aug 25 '12 at 09:37
  • @Velox isn't quite right. Your clone is _already_ a private branch. Your `master` branch just happens to share a name with the server. Working off a single branch is fine. – Jacob Groundwater Aug 25 '12 at 09:51
  • @Volex: I am trying to keep up with the master repo on the local one... Unfortunatley, GIT PULL aborts for me with an error: stating i have local changes :( and then i land up merging two files using a file diff tool, which is extremely time consuming. I know i am not aware of something but i am getting no help on how to resolve it so i tried out the private branch concept. this seems to help me – Nida Sahar Aug 25 '12 at 11:32
  • @NidaSahar you may have worked this out already but you should not use Pull. Use "Fetch" then work out where the differences are. Pull is doing an automatic merge for you, and it's failing. Better to look at the tree in Gitk or similar tool, and understand what's really going on – CJBrew Mar 19 '15 at 14:32

2 Answers2

2

Jan Krueger's extended cheat sheet will help you cover the basics, and will expose you some common commands for using git.

IMO, git is a brilliant DVCS. If you have time; take a look at the structure of git and try to catch the ideas behind its design. For example this Tech Talk by Linus Torvalds.

Note: It looks like you are missing some core ideas behind using git, so please try to learn general approach of git before tackling with commands.

Note 2: As being a stalker, you seem to have general problems with git. So I repeat my advice once more. Learn basics, complete a tutorial, read/listen/watch a few useful source from notable people about git.

Seçkin Savaşçı
  • 3,446
  • 2
  • 23
  • 39
0

Also read about git stash. It saves your local uncommitted changes so you can pull cleanly. Then run git stash pop to replay those changes on top.

jarodeells
  • 356
  • 1
  • 5
  • 14
  • I have tried that... but looks like the file recently merged and my stashed file have conflicting lines, hence it refuses to stash pop :( – Nida Sahar Aug 26 '12 at 08:47