# Tips on version control - git, github, svn



## cap10subtext (Oct 13, 2005)

Simple thread...

I'm not new to version control but every time I use it it's like pulling teeth. Currently struggling with Github. I've read most links I can find about version control and yet I'm having trouble making the leap that every manual seems to make. It's like:
nano README
git add README
git commit -m "I'm so smart: look at my README"
configure keys... blah blah
git push origin

Now fly sucker... 

Let's take a real world example. I want to take an existing project which someone has hosted with git, but it's not on github. It's an insanely large project filled with hundreds of files. I clone it, create a repo, push it, but then when I make local changes and push, I can't, then I try to pull I get spammed with conflicts. So I have to manually fix those conflicts which kind of defeats the purpose of doing all this in the first place. Clearly I'm doing something wrong, but google isn't helping... everything I come across is either conflicting information or says stuff like "git pull --rebase" then manually fix everything (which puts me back to where I started!)

I know it's not the project, other people have successfully made their own branches on github.

The other thing I don't get is that people keep saying "don't worry, you can't screw up version control" and yet, I keep finding myself in a position where the files I've backed up disappeared and I can't figure out how to restore everything without a nuke and pave... And then once again, back to square one...

I need a guidebook called "how to roll with the punches" not "how to start over"...

Anyone have a really amazing resource that I just haven't come across yet? Am I just coming at this the wrong way? Ugh... just frustrated. Wasted a whole weekend just to upload changes to three text files... XX)


----------



## Dennis Nedry (Sep 20, 2007)

[deleted]


----------



## cap10subtext (Oct 13, 2005)

One of the projects I'm working on has half of it's stuff in git the rest is in svn.

I'm not wedded to either one. But I have to admit it's bothering me because of all the challenges I've faced in learning to code over the last 7 years, this one is by far the most aggravating. So maybe it's out of necessity I need to use but i suppose it's stubborn pride that makes me want to use it well. The first project I ever put on version control went on github pretty well because it was what everyone else in my community was using. But I didn't have any revisions, the source was entirely from scratch and it was two years ago.

An from what I've been reading I really don't anticipate SVN to be much of a bother after this headache.


----------



## ChicknAfraid (Jun 6, 2012)

cap10subtext said:


> Let's take a real world example. I want to take an existing project which someone has hosted with git, but it's not on github. It's an insanely large project filled with hundreds of files.


Starting with an insanely large project may not be the best way to learn git. I guess it has an insanely large number of commit every day too?



cap10subtext said:


> I clone it, create a repo, push it, but then when I make local changes and push, I can't, then I try to pull I get spammed with conflicts.


You must be waiting too long to commit or your project isn't mature and so things get moved around pretty fast. Whatever the source control software, it's gonna be messy. You should start with small changes you can commit after a few days and that touch few files. Or in a remote part, not the core. I know, you may not have that luxury, but since I have no details, I can only offer this pretty vague advice. You should tell us more about the project and your contribution.



cap10subtext said:


> The other thing I don't get is that people keep saying "don't worry, you can't screw up version control" and yet, I keep finding myself in a position where the files I've backed up disappeared and I can't figure out how to restore everything without a nuke and pave... And then once again, back to square one...


That's a lie. You can and will often screw up your projects just by using the VCS. CVS was horrendous, SVN is not very good and git is better at handling conflicts, but in the end if you modified a file that was modified twice between your pull and your commit, you're screwed. Which can only be solved by:
- commit often
- commit small changes
- pull before editing a new file, always
- stay clear of the files changing too often. If not possible, your project needs a refactoring so as not to have part of it so central that it changes multiple times each day.



cap10subtext said:


> Wasted a whole weekend just to upload changes to three text files... XX)


If it's only 3 text files, why can't you just pull fresh and re-apply the changes then immediately commit?


----------



## WestWeb (Jul 11, 2009)

Here's a great no nonsense run through of using GIT that might help you out. I know it helped me understand the GIT workflow a lot better: git - the simple guide - no deep ****!

Also, while I do enjoy my Terminal, I find it's nice to have a GIT client for managing projects in GIT. I use "Smartgit" as it is platform agnostic, but I've heard lot's of good things about the mac-only "SourceTree" as well.


----------



## a7mc (Dec 30, 2002)

I'm using SourceTree myself (for Mercurial in my case) and it works great. Can't comment on how well it will work in your case, but I've had no problems with it. Makes version control very easy.

A7


----------



## cap10subtext (Oct 13, 2005)

Okay this is starting to make a bit of sense to me. It's become less frustrating now that I have a rhythm. Though I'm still not sure I started the project correctly. If someone has a project on git and I want to start a branch on Github, what's the best way to do this?

I did clone, create a new repo git add -A and push, but it doesn't preserve any commit history from the original project. It that normal?


----------

