Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Git Hub Help

Author
Message
Seppuku Arts
Moderator
19
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 15th Apr 2015 16:33 Edited at: 15th Apr 2015 16:34
I decided I'd try and get something rolling using GitHub, figured about time I'd try using version control. I've started a project I will be using Rails for and I've been working on some preliminary html layouts. On my desktop, using Git, I have 4 commits, but when I push it to GitHub, I only have 1 commit, my very first commit.

See screenshot for reference (linked, it's a pretty big image):

http://i.imgur.com/0HjXkA4.jpg

On the left, my repository on Github and on the right, my Terminal in Ubuntu showing my git log, with 4 commits.

This is the command I am using to push to my github:

git push --mirror https://github.com/Saefinn/website.git

Every time I push, it says everything is up-to-date. Also set up a remote in git, but still the same when I try pushing it that way. I always went to purposefully make a new commit after setting up the remote and when I push, it still says it's up-to-date.

Any idea what I could be doing wrong?

RedFlames
16
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 15th Apr 2015 19:02
It says "detached HEAD" in there a few times, maybe that's the issue? I tried to figure out what that means, found this link, look at section 8.2:
http://gitolite.com/gcs.html#(48)
(press 'A' to view the whole document instead of the "slideshow" mode... and 'S' to make the text smaller. Dunno why anyone thought making that a slideshow was a good idea!)

It's been a few years since I used git/github and even back then I only understood the basics. What did you do besides a "checkout", some "add" commands and the "commit" / "push"?
Maybe it's doing that because of the "--mirror" option? Is that one necessary there?

But as I said I don't really understand git well enough to be helpful here.
Seppuku Arts
Moderator
19
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 15th Apr 2015 19:11 Edited at: 15th Apr 2015 19:12
I think it could well be it - I looked up pushing files to GitHub online and the source I found used --mirror. I've since set up a second repository to retrace my steps and just did it without the --mirror and seems to be working okay. Now I've got a repository with multiple commits and can push and pull effectively.

I suspect that's done it.


Cheers.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Apr 2015 19:42
I use SourceTree with BitBucket. Command line interfaces may make you feel manly, but you can waste time that is best spent on your actual project, rather than the management of it.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
The Zoq2
14
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 15th Apr 2015 19:53
My experience is that GUIs are good in the beginning but once you get used to how it works, command line is faster.

alt+enter
cd <wherever my project is>
git add <what I want to add>
git commit -m <message>
git push

is a lot faster for me than doing it in a gui.

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
Seppuku Arts
Moderator
19
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 15th Apr 2015 20:00 Edited at: 15th Apr 2015 20:01
Dunno if I feel manly. Maybe if I drink a beer and wolf whistle some poor unsuspecting woman?

I was learning to use Git, so figured best to learn the command line stuff first, so if I ever need to use it at command line level, then I know what to do. But I know there's GUI's for it, like GitCola, so I'm more likely going to use that in practice. Depends what I find more convenient in the end. Stuff can be pretty quick with Git in command line.

Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 15th Apr 2015 20:06
I've never used the --mirror option so that's probably doing something different than a typical push/pull.

To push a repository up to Github I just set the origin via:


And then push/pull like normal (e.g. git push origin <branch>.

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 15th Apr 2015 21:17 Edited at: 15th Apr 2015 21:31
You're in a detached state. This means there's no tag (such as "master") pointing to the commit you're on, you're somewhere back in history. Did you run something like "git checkout <hash>"?

Usually, in order to get back to where you were before you checked out some other commit, you would type:


In this case, you would be returning to the front of the branch "master", the default branch, without taking any of the committed changes you made with you. Note that this may fail if you have modified files - in this case you either have to discard the changes you made, or continue reading.

If you've modified files or made a few commits and want to keep the changes you made, you'll have to merge those changes into master (or whatever branch you branched off from) with:


Read this to understand how branches work: http://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell

It's really quite elegant and easy to understand.

I also urge you to read the manual: http://git-scm.com/doc

Quote: "I use SourceTree with BitBucket. Command line interfaces may make you feel manly, but you can waste time that is best spent on your actual project, rather than the management of it."


GUI front-ends are good as an introduction to git, but once you understand the basics, it's better to use the command line. You're faster and you have more control.

Need help with C/C++ game dev? PM me or add me on skype: the__comet.
Current active project: Light Ship
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 15th Apr 2015 21:31
I do find that doing a merge is much easier in a GUI compared to manually editing the file in a terminal. So I'll do the vast majority in the commandline/terminal, but resolve merge conflicts in a GUI.

It ultimately comes down to user preference.

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 15th Apr 2015 21:41
Quote: "I do find that doing a merge is much easier in a GUI compared to manually editing the file in a terminal. So I'll do the vast majority in the commandline/terminal, but resolve merge conflicts in a GUI."


I've been told too that resolving merge conflicts is easier in a GUI. I wouldn't know, I just manually resolve them in the conflicting files by deleting whatever is relevant:


Fix:


They don't happen that often if the team is coordinated well.

Need help with C/C++ game dev? PM me or add me on skype: the__comet.
Current active project: Light Ship
Seppuku Arts
Moderator
19
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 15th Apr 2015 22:02
Ah, well that makes perfect sense and would explain why when I redid everything that it worked. I've got to grips with using branches now.

But as you say, it is easy to understand, it just looks daunting to use, but actually, it's quite straight forward. Everything is working as it should be.

I can see how branches will be useful. Master, of course, being the 'main' version of my source, which may be how I release what I code. Then these branches work well if I want to branch out and add new features and work within a separate environment. Yes, now I can see why you keep nagging people about version control.

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 15th Apr 2015 23:06 Edited at: 15th Apr 2015 23:09
Branches are very cheap in git (you can have thousands of branches without fearing that something will break, unlike with other VCS).

A thing I like to do is have an additional "devel" (and if the project is large enough, a "topic" branch as well):
http://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows

"topic" is dedicated to the current topic of development. "devel" is dedicated to snapshots that compile successfully, but are unstable. Whenever the project reaches a stage where it can be considered stable, I merge devel into master.

This workflow has saved me a few times when the boss suddenly drops in and demands to see a "working version". You can just switch branches quickly.

Need help with C/C++ game dev? PM me or add me on skype: the__comet.
Current active project: Light Ship
RedFlames
16
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 16th Apr 2015 01:53
When I googled the detached head thing, I was looking at some beginners guides for git and read this:
Quote: "The problem with Git is that it’s so ancient that we have to use the command line — or Terminal if you’re a Mac user — in order to access it, typing in snippets of code like ‘90s hackers. This can be a difficult proposition for modern computer users. That’s where GitHub comes in."

...that's where I decided not to read that and go look at something else instead.

I don't think you can use Ubuntu (or Linux in general) without using terminals. That's just how stuff works. What's so bad about 'em? Atleast you get to feel like a hacker! And then you can make a Visual Basic GUI to track someones IP!
Seppuku Arts
Moderator
19
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 16th Apr 2015 02:16 Edited at: 16th Apr 2015 02:20
Quote: "And then you can make a Visual Basic GUI to track someones IP! "


Oh dear, CSI >.>


Quote: "I don't think you can use Ubuntu (or Linux in general) without using terminals."


You can, Ubuntu has tried to make things a lot more user friendly - you can have a decent user experience without needing to use terminals once.

And you can git in Ubuntu without terminals too, so their point is moot. They can get gitCola from the Ubuntu software center. So if using a commandline or terminal is a turn off, you don't /have/ to use it.

But, I can see why people do and I don't find it to be a headache now that I know how to use it.

Quote: "A thing I like to do is have an additional "devel" (and if the project is large enough, a "topic" branch as well):"


The way I was planning on doing it was to have my main "master" as what's ready to be deployed and use each branch for each feature, so to speaks - or your topics. I can see an argument for the development branch, but I suspect for me, it might end up redundant.

But in good news, my Rails project base is now working perfectly fine in GitHub. So I'll be able to start working on it.

Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 16th Apr 2015 06:19
Quote: " The way I was planning on doing it was to have my main "master" as what's ready to be deployed and use each branch for each feature, so to speaks - or your topics. I can see an argument for the development branch, but I suspect for me, it might end up redundant."

That's also a common way to do it. Another way, though this is using some more advanced ways to do things, is to 'tag' a release or have a branch that defines a version of the software.

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 16th Apr 2015 09:14
Quote: "I don't think you can use Ubuntu (or Linux in general) without using terminals. That's just how stuff works."


I don't understand why there's a stigma against Linux terminals. Everyone assumes that it's this super advanced tool that only hackers are capable of using, and try to keep as much distance from it as possible.

What are you all so afraid of? Did you have a bad experience with the Windows CMD, and then assume that all Linux terminals must also be that terrible?


The other day I was asked by my colleagues to connect my laptop to the beamer, because their laptops weren't cooperating for whatever reason. It went something like this:
> I plug in the VGA cable
> Picture doesn't show up on the beamer immediately, because in Linux things don't happen unless you tell them to
> Colleague goes "Well, I guess yours doesn't work either, so much for Linux being superior"
> I ignore the jab and open a terminal.
> "Is that a command line??"
> "Yes, this is a command line"
> Everyone laughs
> Colleague says "We're screwed"
> I start typing
- the command for enabling video output.
> Colleague unplugs my laptop before I could finish.
> He tells me to "Take my hacks somewhere else"
> They spend the next 10 minutes fiddling with Windows driver settings

Need help with C/C++ game dev? PM me or add me on skype: the__comet.
Current active project: Light Ship
The Zoq2
14
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 16th Apr 2015 13:57
Quote: "
I don't understand why there's a stigma against Linux terminals. Everyone assumes that it's this super advanced tool that only hackers are capable of using, and try to keep as much distance from it as possible.
"


Movies probably have something to do with it, you don't see a hacker click on buttons

It's also a bit harder to understand if you are not used to it. XRandr is great and I really prefer it over a GUI version but unless you have seen it before you have no idea what that command would do. The command name is pretty weird, the flags are understandable but figguring out DVI-I-2 and LSDVS-I-0 isn't that easy either unless you have seen it before.

Quote: "What are you all so afraid of? Did you have a bad experience with the Windows CMD, and then assume that all Linux terminals must also be that terrible?"


But only hackers use commandlines!!!!

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
Seppuku Arts
Moderator
19
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 16th Apr 2015 15:53
Command line looks scary, but so does programming and the latter is more complicated of the two. After learning it, no I don't get why there would be stigma. Granted it isn't a necessity and might be considered out dated but has advantages.

The reason I've learned it is because Ruby on Rails pretty much has you running from the command line. However, I could avoid it by using RubyMine, which takes care of it for me and I may go that route should I buy it. But command line and Komodo edit is nice and free and pretty straight forward.

RedFlames
16
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 16th Apr 2015 16:25
Quote: "> He tells me to "Take my hacks somewhere else""

That story sounds so infuriating. They were probably afraid you'd install a rootkit on their beamer. Or run "rm -rf /" on it.

Quote: "I don't understand why there's a stigma against Linux terminals. Everyone assumes that it's this super advanced tool that only hackers are capable of using, and try to keep as much distance from it as possible.
"


I don't get it either. I assume it's because we're so used to doing everything with a pretty GUI. And a CLI is less intuitive; you have to know the commands you want to use or how to find information on them... there's definitely a learning curve if you've never used linux.
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 17th Apr 2015 04:32
@TheComet
This makes me glad that I work in a Linux-friendly area. The terminal is so powerful, though there is certain functionality that should be put into a GUI.

Login to post a reply

Server time is: 2024-04-19 05:41:33
Your offset time is: 2024-04-19 05:41:33