You are not logged in.

#1 2009-05-28 10:25:06

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

[SOLVED] Suggest a SIMPLE Code Repository System... Please?

OK guys, I've tried several times to get my head around CVS, SVN and GIT but they're just not making sense. I need a simple, easy to understand and use code repository for a single developer.

The code I work on has a single maintainer (me) so I don't need distributed, multi-person, multi-language, multi-timezone I-can-do-everything type system like the above packages... Just something simple that will allow me to have the ability to:
1) Flag a particular set of files as the current stable and be able to 'check out' those file for use / compilation.
2) Work on a development / testing line of code.
3) Revert back to the last "stable" if my testing / development ends up being a bucket load of fail.
4) Have a history of the code so I can see when things were added/removed.

I don't even know if such a thing exists, but if it does, it would be handy. Something a step above taking a tarball of the code when it's stable and untarring it back if I fsck things up tongue

Maybe I'm better off sticking with manually tarballing things? Maybe I shouldn't be coding things if I can't understand CVS / SVN / GIT?

Last edited by fukawi2 (2009-05-29 11:43:28)

Offline

#2 2009-05-28 10:50:40

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Well there's mercurial, but I stopped using that once I found git. Git branches are really awesome, and very easy.

I wrote/found this cheatsheet when I started using it:
http://wiki.archlinux.org/index.php/GIT
There's also another one, but more detailed and oriented towards working with others and sending things upstream.
http://wiki.archlinux.org/index.php/Sup … _Git_Guide

Last edited by iphitus (2009-05-28 10:51:50)

Offline

#3 2009-05-28 14:35:47

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Ironically, git's learning curve is probably not as steep if you're learning it from scratch instead of coming from an existing system. I suggest taking the time now to learn the basics that you'll need as a single developer -- ignoring the distributed features and other things you don't need are trivial, but knowing that something like git-bisect or git-rebase is available when you need it will allow you to experiment fearlessly.

I don't know of anything 'simpler' than the tools you mentioned -- Mercurial, bazaar, and darcs are all options, but I suspect they're a bit heavy for you.

Dusty

Offline

#4 2009-05-28 15:00:55

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

I'm using CVS to work on CS-Man because me and my friend just need something basic/simple and there's support for it right in the Eclipse IDE. We only use a subset of its features, and I like it so far. The use to us is quickly updating code that is then accessible from anywhere, and the revision history itself.

Offline

#5 2009-05-28 23:36:45

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Thanks guys -- I guess I'll have to keep looking around, and/or devote more time to trying to get my head around things.

iphitus -- Allan pointed me to those in another thread a week or so ago when I asked OT about simple GIT guides. They both make my head spin though hmm

I forgot to mention, I tend to code using vi, none of this fancy GUI IDE stuff like Eclipse or NetBeans tongue  However that means I don't get to use the code repo functions of these IDE's too

Offline

#6 2009-05-29 01:16:19

madalu
Member
Registered: 2009-05-05
Posts: 217

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

fukawi2 wrote:

OK guys, I've tried several times to get my head around CVS, SVN and GIT but they're just not making sense. I need a simple, easy to understand and use code repository for a single developer.

The code I work on has a single maintainer (me) so I don't need distributed, multi-person, multi-language, multi-timezone I-can-do-everything type system like the above packages... Just something simple that will allow me to have the ability to:
1) Flag a particular set of files as the current stable and be able to 'check out' those file for use / compilation.
2) Work on a development / testing line of code.
3) Revert back to the last "stable" if my testing / development ends up being a bucket load of fail.
4) Have a history of the code so I can see when things were added/removed.

I don't even know if such a thing exists, but if it does, it would be handy. Something a step above taking a tarball of the code when it's stable and untarring it back if I fsck things up tongue

Maybe I'm better off sticking with manually tarballing things? Maybe I shouldn't be coding things if I can't understand CVS / SVN / GIT?

When I saw the title of this post, I was about to recommend RCS. But it seems to me that your needs are relatively complex. So IMHO, you'll want a tool that is robust and complex enough task. And from what you've described I think something like git would be perfect. I'm sure mercurial or bzr would work just as well. Learning git is a lot simpler than learning vim or emacs!

Here are the steps I would use for the scenario you described above:

1) Create a repository. In your working directory type:
- git init [initializes repo]
- git add . [adds all files in the directory to the repo]
- git commit -a -m "Creating master repository" [Commits those files to the repository.]

2) Create a new branch for messing around with.

- git checkout -b "crazy-changes" [create and switch to a new branch named "crazy-changes"]
- Make a bunch of crazy changes.
- git branch [double check to make sure you're on crazy-changes branch]
- git commit -a -m "Some crazy changes" [-m is the message flag; if you don't add you'll be prompted to create a message in your default editor]
- Test the changes.

3) If the crazy-changes branch was a bucket "load of fail":

  - git checkout master
  - git branch -D crazy-changes [capital D here deletes the branch even if it has unmerged changes]

4) If the crazy-changes branch was good:

  - git checkout master [switch to master branch]
  - git pull . crazy-changes [merges crazy-changes into master branch]

5) See the history of your changes

  - git log

6) Backup your repository.

  - git clone . /path/to/backup-repo

Repeat as needed. Obviously, there's a lot more complex stuff you can do (tags, remote repositories, etc.). But I think this should cover the requirements you described.

Last edited by madalu (2009-05-29 01:18:48)

Offline

#7 2009-05-29 01:28:56

madalu
Member
Registered: 2009-05-05
Posts: 217

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

I'm afraid I may have just duplicated what's already in the wiki. Oh well, there can never be too many git cheat sheets!

Offline

#8 2009-05-29 01:31:50

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Nice madalu, thanks smile

I presume the pwd for each step above would be:
1) /path/to/code/repo
2) /path/to/testing
3) /path/to/testing
4) /path/to/testing

What do I do to get my stable branch for production?

cd /srv/http/production/
git checkout -b "production"

Is that right? Would that possibly make code (history) etc available for anyone with a WWW browser to access through a .git directory or something (bad)? Then once I've done crazy-changes and committed that branch back to the master, repeat again?

Last edited by fukawi2 (2009-05-29 01:32:54)

Offline

#9 2009-05-29 02:50:53

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Since you are using Vim, you might possibly try a repository manager script like vcscommand.vim : CVS/SVN/SVK/git integration plugin


To know or not to know ...
... the questions remain forever.

Offline

#10 2009-05-29 03:34:43

akira86
Member
Registered: 2009-01-16
Posts: 119

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

There is a tool for beginners (like me) with git : gitk
It's a GUI that allow you to do simple management on your project.

Offline

#11 2009-05-29 03:49:49

madalu
Member
Registered: 2009-05-05
Posts: 217

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

fukawi2 wrote:

Nice madalu, thanks smile

I presume the pwd for each step above would be:
1) /path/to/code/repo
2) /path/to/testing
3) /path/to/testing
4) /path/to/testing

In fact, all this takes place in your code directory. So let's say you were already working on the project "~/foobar/".

Even if you had been working on it for years already, you could still initialize a git repo in it by using step one (git init; git add .; git commit -a).

This will create the data for the repo in the directory "~/foobar/.git". (BTW, you could get rid of the repo at any time by deleting the directory "~/foobar/.git").

The beauty of git is that when you switch to another branch, your path doesn't change. So when you do "git checkout -b crazy-changes", you'll still be working in "~/foobar/". But when you change and commit to crazy-changes, the changes will be committed only to the crazy-changes branch. Thus, if you switch back to the master branch ("git checkout master"), you'll still be in "~/foobar/", but you won't see any of your crazy-changes. Even better, you can have as many branches as you want. So in my example above, you wouldn't necessarily have to delete the crazy-changes branch even if you didn't like what you did. (I've heard it reported that Linus Torvalds thinks of git as a really sophisticated file system.)

fukawi2 wrote:

What do I do to get my stable branch for production?

cd /srv/http/production/
git checkout -b "production"

Is that right? Would that possibly make code (history) etc available for anyone with a WWW browser to access through a .git directory or something (bad)? Then once I've done crazy-changes and committed that branch back to the master, repeat again?

For this you could use "git archive" to spit out a snapshot of your repo---either the current commit (HEAD), a particular branch, or any version/commit in the past.

See http://www.kernel.org/pub/software/scm/ … chive.html

Last edited by madalu (2009-05-29 03:50:59)

Offline

#12 2009-05-29 03:50:35

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

fukawi2 wrote:

Nice madalu, thanks smile

I presume the pwd for each step above would be:
1) /path/to/code/repo
2) /path/to/testing
3) /path/to/testing
4) /path/to/testing

What do I do to get my stable branch for production?

cd /srv/http/production/
git checkout -b "production"

Is that right? Would that possibly make code (history) etc available for anyone with a WWW browser to access through a .git directory or something (bad)? Then once I've done crazy-changes and committed that branch back to the master, repeat again?

the pwd doesnt change. Here's an example of how branches  work.

iphitus@tsiolkovsky:~/packages$ git init  # just a few lines to create an example repo...
iphitus@tsiolkovsky:~/packages$ git add PKGBUILD
iphitus@tsiolkovsky:~/packages$ git commit -a -m "wha"
[master (root-commit) 2cffc7b] wha
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 PKGBUILD
iphitus@tsiolkovsky:~/packages$ git branch # list of branches, just master at the moment.
* master
iphitus@tsiolkovsky:~/packages$ git branch breakstuff      # branch created
iphitus@tsiolkovsky:~/packages$ git branch # see the new branch?
  breakstuff
* master
iphitus@tsiolkovsky:~/packages$ git checkout breakstuff # change to the new branch
Switched to branch 'breakstuff'
iphitus@tsiolkovsky:~/packages$ git branch  # See how breakstuff is now selected. I can now break things, but master is always there to swap back to.
* breakstuff
  master
iphitus@tsiolkovsky:~/packages$ git checkout master # change back to master
Switched to branch 'master'

Just like that, you can change between different working branches of code.

As for sharing a repo... have a look here.
http://toolmantim.com/articles/setting_ … repository
In the 'impatient' section
* you create a bare git empty repository on the remote host. You can make it locally and upload if you want.
* Add that remote repository as a branch on your local repository
* git push to that branch you just created.
It explains it in more detail further down the page.

Last edited by iphitus (2009-05-29 03:58:08)

Offline

#13 2009-05-29 04:31:51

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Hmmm, starting to make sense guys -- thanks heaps for your patience and time smile

Last question I hope... The idea is to never actually change 'master' directly but to checkout a branch, make changes, and then merge ('commit') them back to master? Is that correct?

Offline

#14 2009-05-29 07:06:56

bwalk
Member
Registered: 2007-03-21
Posts: 177

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

You can do so, yes. You can change master itself of course, it is just another branch. It's more like how you want to do those things.

Offline

#15 2009-05-29 10:26:19

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Also with git you have http://github.com which is absolutely fantastic. Check out their guides section. If you google around for git guides, there's a lot more too.

Offline

#16 2009-05-29 11:43:56

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Thanks again guys... I'll mark this as solved for now, and have a play around smile

Offline

#17 2009-10-18 02:36:45

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

OK, so I've been having a play, and I'm trying to get my dotfiles into a git repo to try and keep some kind of order for my bashrc, ssh config etc between my home desktop, home server, work desktop, laptops and various servers around the world wink

So I've started with my home server, and init'ed a git repo in my home dir, then added .ssh/confg and my ssh private key

fukawi2@kangaroo ~  $ git init
Initialized empty Git repository in /home/fukawi2/.git/
fukawi2@kangaroo ~  $ git add .ssh/config
fukawi2@kangaroo ~  $ git add .ssh/privatekey_personal.dsa
fukawi2@kangaroo ~  $ git commit -m 'initial commit of ssh config and key'
[master (root-commit) cd0dac1] initial commit of ssh config and key
 2 files changed, 112 insertions(+), 0 deletions(-)
 create mode 100644 .ssh/config
 create mode 100644 .ssh/privatekey_personal.dsa

I then added a remote repository (one of my VPS'es) which I want to act as the 'central' server I can access from anywhere to pull/push any changes I make from any of my computers:

fukawi2@kangaroo ~  $ git remote add emu ssh://emu/home/fukawi2/
fukawi2@kangaroo ~  $ git push emu master
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 1.36 KiB, done.
Total 5 (delta 0), reused 0 (delta 0)
To ssh://emu.falconn.nl/home/fukawi2/
 * [new branch]      master -> master

How do I now get *that* VPS (emu) to see my dotfiles? They seem to only exist in the .git directory in my home, and I can't figure out how to clone/pull the repo.

Last edited by fukawi2 (2009-10-18 02:37:26)

Offline

#18 2009-10-18 05:50:30

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Remember when I recommended git, how I said "push" was a little funny?

Git, by default, assumes you are pushing to a computer being used by someone.  As such, it will not change the working files, just add the updates to the repository (e.g, it will not nuke whatever they are working on).  The person on the pushed computer will notice this and take the necessary action, either merging the changes or reseting forwards (yeah, weird) to the new head.

Automatic pushing to remote computers:
http://git.or.cz/gitwiki/GitFaq#Whywon. … push.22.3F

Glad git is starting to work out for you.  Here is the guide that made it click for me:
http://www.eecs.harvard.edu/~cduan/technical/git/

late edit: Tig (in community) is a good way to explore the logs.

Last edited by keenerd (2009-10-18 06:09:32)

Offline

#19 2009-10-18 07:03:05

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

That is a good document... It's cleared some things up but I still can't get this to work.

On the remote server, in my home directory:

git init

On my local server, in my home directory:

git init
git add .ssh/config
git remote add emu ssh://emu.domain.com/home/fukawi2/
git commit -a -m 'initial commit'
git push emu master

This pushes the changes as commits to the .git directory on the remote server, but doesn't create .ssh/config on the remote server. If I login to the remote and run:

git clone ./

It then creates /home/fukawi2/fukawi2/.ssh/config - note the second level of 'fukawi2' within my home directory.

Last edited by fukawi2 (2009-10-18 07:03:41)

Offline

#20 2009-10-18 08:58:01

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Either enable the push hook described in the git FAQ link (so that pushes overwrite the working directory), or use the command
git reset --hard HEAD
on the remote system.

"git clone" will always make a new repo.  So if you are in /tmp/, and you "git clone /home/fukawi2/", it will mirror the repo to /tmp/fukawi2/.  If you are in /home/bob/, it will make the repo /home/bob/fukawi2/.  Finally, if you are in /home/fukawi2/, it will make /home/fukawi2/fukawi2/, and you'll have a repository inside a repository.  Please don't do this.

If it seems confusing, just think of the git repo as a tarball, and unzipping/cloning it produces the files in a new directory of the same name.

Last edited by keenerd (2009-10-18 09:05:04)

Offline

#21 2009-10-18 21:28:05

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

keenerd wrote:

Either enable the push hook described in the git FAQ link (so that pushes overwrite the working directory), or use the command
git reset --hard HEAD
on the remote system.

That was the command I was after, thanks big_smile

Now to read up on exactly what it means...

EDIT: answered my own question wink

Last edited by fukawi2 (2009-10-18 21:30:27)

Offline

#22 2009-11-14 06:19:55

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Yay, another problem!

I have stuff hosted with github... I created a new branch on my work computer and pushed it to github, so now I have "master" and "iptables-rewrite" branches on github.

I tried to pull those changes from github to my home computer using:

git pull github master

Which was all good, but it didn't pull the 'iptables-rewrite' branch. So I ran:

git pull github iptables-rewrite

And it pulled the branch, but it seems to have overwritten my local master with the remote iptables-rewrite branch! I can't figure out how to get rid of the 'iptables-rewrite' changes from my local master branch. If I try to pull the github/master branch again, it says it's already up to date sad

fukawi2@phil-desktop ~/ArchServer/base  $ git branch
* master
fukawi2@phil-desktop ~/ArchServer/base  $ git pull github master 
From github.com:ArchServer/base
 * branch            master     -> FETCH_HEAD
Already up-to-date.

Offline

#23 2009-11-14 06:47:06

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,410
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

I guess you wanted to create a local branch with the iptables-rewrite branch.

git checkout -b iptables-rewrite origin/iptables-rewrite

Offline

#24 2009-11-14 09:12:48

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Yes, that's probably the one.. Thanks Allan smile

Any suggestions how to revert my local 'master' to be the correct master instead of the 'iptables-rewrite' branch? You command with 'master' instead of 'iptables-rewrite' gives me:

fatal: git checkout: branch master already exists

Offline

#25 2009-11-14 09:45:53

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: [SOLVED] Suggest a SIMPLE Code Repository System... Please?

Ah-ha! Found it big_smile

git reset --hard HEAD^

Offline

Board footer

Powered by FluxBB