Git help

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
User avatar
Launfal
Dirty Laundry
Posts: 141
Joined: Tue Mar 04, 2014 12:50 am
Location: Ohio, USA

Git help

Unread post by Launfal » Fri Jul 11, 2014 5:00 pm

OK, I'm a complete git/Github noob. I've got this xcolor theme and scrot I wanna upload to our repo, but I have no idea what I'm doing, and all the tutorials I'm finding online are about working with my own repo, which I do know I'm not doing. I don't wanna start banging out commands and screwing something up. I didn't find anything in the wiki about contributing to the repo, but if I missed it, point me in the right direction, please.

I installed git, so I think I'm ready to do...something. Can somebody help a brother out?

And while I'm on the subject, I understand git is for code, but it seems that it should be something I could use for my stories and manuscripts, maybe using the same kind of version control that coders use. Am I on the right track there? Once I get the basics, could I use it as a central place to control which version of which draft I'm working on?

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Git help

Unread post by dkeg » Fri Jul 11, 2014 5:19 pm

I'm at work now, but I'd be more than happy to put something together for you tonight.

Work hard; Complain less

User avatar
Launfal
Dirty Laundry
Posts: 141
Joined: Tue Mar 04, 2014 12:50 am
Location: Ohio, USA

Re: Git help

Unread post by Launfal » Fri Jul 11, 2014 5:25 pm

^ that would be way sweet. thanks a ton.

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: Git help

Unread post by rhowaldt » Fri Jul 11, 2014 8:45 pm

Laundry: cool idea with the writing version control.
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.


User avatar
Launfal
Dirty Laundry
Posts: 141
Joined: Tue Mar 04, 2014 12:50 am
Location: Ohio, USA

Re: Git help

Unread post by Launfal » Sat Jul 12, 2014 4:41 am

^ Thanks for these links. I'll be surfing/reading intensely for quite a while.

Author is a nice spin. I just had trouble with the wm's, but I plan on giving it another go at some point.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Git help

Unread post by machinebacon » Sat Jul 12, 2014 5:24 am

Oh be patient, I am sure you get a personalized spin in a few days ;)

Just let me know what setup you prefer, plugins and stuff, and you can get a portable "Laundry" spin for a small USB stick
..gnutella..

User avatar
Launfal
Dirty Laundry
Posts: 141
Joined: Tue Mar 04, 2014 12:50 am
Location: Ohio, USA

Re: Git help

Unread post by Launfal » Sat Jul 12, 2014 2:14 pm

^ Funny you should say that (and thank you, by the way) because I've been trying to modify the Author setup for my own rig. I just don't have the time to do the modding I would like.

My needs are simple, so a 686-nonpae no-x (xorg and 64-bit for writing? why exactly?) spin of author, without emacs and worgrinder, would be just about perfect. Replace the vim suite (I don't Latex and I don't write screenplays) with the plugins from http://wynnnetherland.com/journal/reed- ... or-writers and that's handled. Git for version control of manuscript versions (once I learn how), add powerline for tmux and vim, and bang, all done. I don't even use fbterm anymore since without tinting, backgrounds on tty are just distracting. Colorscheme to suit my mood and I'm good.

If do my occasional printing on my wife's WInbox, and I won't even need cups/hplip, and thus no systemd for a while, either.

Oh, and I'd lose Wordgrinder, too. I love the idea, and I've been trying to dig it, but without printing and spellcheck, I need vim around to write with anyway.

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Git help

Unread post by dkeg » Sat Jul 12, 2014 2:19 pm

disclaimer, I'm sure Joe would have a more proper tutorial for this.

Generally speaking ... we're looking at two separate things here, using git locally and with a service such as GitHub or Bitbucket.
Using locally:

Code: Select all

sudo apt-get install git
initialize the directory, add the items, commit

Code: Select all

cd /dir/for/git
git init
git add -A 
#above is all to add all items. You can add specific items too
git add file1 file2 file3
git commit -m 'm is for message, add your message here'
git status #check current status
First things first, create you ssh key

Code: Select all

ssh keygen -t rsa "email"
Copy the public key and use that for your key in GitHub/Bitbucket

Code: Select all

cd ~/.ssh
<editor> id_rsa.pub
Connecting with a remote server. Pretty much the same as above, of course we need to specify our remote location

Code: Select all

cd /dir/for/git
git remote add origin [email protected]:gituser/reponame.git
git push origin master
When we push origin master, we push up to our remote GitHub account.

When you are happy with you current state, you can create a branch, and work off the branch.

Code: Select all

git branch <branchname>
Move to the new branch

Code: Select all

git checkout <branchname>
Create and move to all in one

Code: Select all

git checkout -b <branchname>
Now you can do all your work on the branch, when you're happy, commit and merge it with master

Code: Select all

git commit -m 'commit message'
git checkout master
# check the current working branch
git branch
git merge <branchname>
You can either keep the branch or delete

Code: Select all

 git branch -d <branchname>
For cloning a repo

Code: Select all

git clone [email protected]:gituser/reponame.git
cd reponame
# track it
git remote add upstream git://github.com/gituser/reponame.git
git fetch upstream
# I generally do
git pull
To help keep my clones organized I create a git directory

Code: Select all

mkdir git
cd git
git clone .....
be happy and organized

Other cool stuff

Code: Select all

git diff
git log --graph
More disclaimer, please don't by shy about questions. Again, I am not a pro at this, its mainly from what I've picked up from personal use. There is obviously so much more that can be done, and possibly better ways to do stuff. For my configs and such I generally don't branch, but when I was coding, I would definitely branch.

Hopefully I didn't leave anything important out.

Edit: IIRC when you add a remote origin,if its added as https, not ssh. You can change that with set-url

Code: Select all

git remote set-url origin [email protected]:gituser/reponame.git

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Git help

Unread post by machinebacon » Sat Jul 12, 2014 3:58 pm

Drew, thank you very much for the howto, this is a nice quick reference!
Launfal wrote:- 686-nonpae
- no-x
- without emacs
- vim + plugins from http://wynnnetherland.com/journal/reed- ... or-writers
- git/tig
- powerline for tmux and vim
- spellchecker (aspell/ispell)
- some gimmicks like definition look-up, thesaurus, one-command-mount-all, fuse, lp
Noted. Give me a few days.
..gnutella..

User avatar
Launfal
Dirty Laundry
Posts: 141
Joined: Tue Mar 04, 2014 12:50 am
Location: Ohio, USA

Re: Git help

Unread post by Launfal » Mon Jul 14, 2014 2:59 am

@ dkeg, thanks a lot for taking the time to put that together. I've printed it out, and I'll be working through it step by step to get a feel for how it all works.

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Git help

Unread post by DebianJoe » Mon Jul 14, 2014 10:02 am

dkeg wrote:disclaimer, I'm sure Joe would have a more proper tutorial for this.
I think you covered the basics quite well. As the need for more knowledge presents itself, problems arise, etc. then I would expect that the vast wealth of knowledge that can be found regarding git will allow someone to organically find their own answers. Very cool of you to type this all out, and if there are specific questions that are not clearly answered by RTFM (they all are, but some are slightly confusing in execution or terminology at first), then feel free to ask.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: Git help

Unread post by GekkoP » Fri Jul 18, 2014 10:35 am

Thanks for the tutorial, Drew, I now have my github ready: https://github.com/boccaperta-it :)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Git help

Unread post by machinebacon » Fri Jul 18, 2014 10:54 am

^ was about time ;) added you to the bbq team
..gnutella..

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: Git help

Unread post by GekkoP » Fri Jul 18, 2014 1:23 pm

^ yeah thanks! It took me a while mainly because I didn't know what to commit on this thing. :D

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Git help

Unread post by machinebacon » Fri Jul 18, 2014 8:16 pm

^ I'd like to see team members storing their configs there, so that they are accessible at one point, and not only in the repos of the users. Of course this is completely optional :)
..gnutella..

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: Git help

Unread post by GekkoP » Sat Jul 19, 2014 8:03 am

^ Ok, I added my .emacs, I'll see what I can add next.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: Git help

Unread post by GekkoP » Sat Jan 10, 2015 2:59 pm

TIL about revert.

Code: Select all

git reset --hard <commit>
Very, very useful when you want to go back to a working commit (i.e.: Emacs trunk messed up by latest commits and you want a working release of that)

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Git help

Unread post by dkeg » Sat Jan 10, 2015 3:17 pm

cool GP. Thanks. Nice thread bump.

This has been a cool reference site.

Work hard; Complain less

Post Reply