Questions about GitHub

  • china-richway2
    8th Oct 2013 Member 0 Permalink

    1.How to edit multiple files in one commit?

    2.How to delete commits?

  • xetalim
    8th Oct 2013 Member 0 Permalink
  • jacob1
    8th Oct 2013 Developer 1 Permalink
    @china-richway2 (View Post)
    try reading this: https://powdertoy.co.uk/Wiki/W/Github_Setup.html

    You shouldn't be editing code from github.com, that isn't the right way at all.

    Also you can never delete commits, but you can revert them., if you get a git client, and not edit from github.
  • mniip
    8th Oct 2013 Developer 0 Permalink
    @jacob1 (View Post)
    you can, just reset to the commit before, and it will be unaccessable
  • boxmein
    8th Oct 2013 Former Staff 1 Permalink
    @jacob1 (View Post)
    git rebase ??????

    @china-richway2 (View Post)
    first off: learn to http://pcottle.github.io/learnGitBranching/
    second off: just do
    git commit file1.txt file2.txt -m "added DRM to text files"


    third off: delete commits only if you know what you're doing.
    if you need to revert uncommited changes to a file do
    git checkout -- file.txt

    if you need to revert all changes in working directory do
    git reset HEAD

    if you need to revert the changes of a previous commit do
    git reset --soft HEAD^
    or rather
    git revert HEAD
    then commit again with new changes. This is basically inverting the changes of a commit.
    if you need to nuke the commit and all with it do
    git reset --hard HEAD^
    but that is a Very Bad Thing™


    Edited 3 times by boxmein. Last: 8th Oct 2013
  • mniip
    8th Oct 2013 Developer 0 Permalink
    @boxmein (View Post)
    i've never used --hard (--soft is the default), usually just reset-stash
  • jacob1
    8th Oct 2013 Developer 0 Permalink
    @mniip (View Post)
    yes, I have reverted commits like that before. I was just making it simple for now ...

    ___

    He should probably not use the command line unless he can't figure out smart git / git gui. Both of those are really easy to understand though, and the guide explains how to use smart git.
  • boxmein
    8th Oct 2013 Former Staff 0 Permalink
    @jacob1 (View Post)
    :I stop dissing the command line
  • jacob1
    8th Oct 2013 Developer 0 Permalink
    @boxmein (View Post)
    there's nothing wrong with it, it's just why does everyone need to use it? I remember when I used to try and do git things with it, and I couldn't figure out how to edit a commit message or something, because there was no obvious way to edit the text editor. It was just complicated for me back then. And even figuring out how to cd into the right directory can be hard/annoying for some people.

    A gui client like git gui is very simple though. smart git does a little more and is a little more complicated, but still good. Everything is done with buttons that you click, you don't have to memorize certain command line things, and then google it when you can't remember.

    By now I know some command line git things, but I always thought it was pointless to remember. a gui client I will never forget how to use.
  • MiningMarsh
    8th Oct 2013 Member 0 Permalink

    @jacob1 (View Post)

    And for the same reasons I don't bother trying to remember a lot of GUI things, I find them harder to remember.

     

    in vim w stands for write, q stands for quit, etc, that comes rather naturally to me.

     

    In a GUI I have to remember what an option is called and under what menu it sits. Of course, I still have to remember that : is for commands in vim, but I find the mental effort much smaller than remembering menu stuff.

     

    Sometimes command line is easier, sometimes a GUI, its not pointless to remember a command line client or a GUI client if it is easier than the alternatives.