ebeshero / DHClass-Hub

a repository to help introduce and orient students to the GitHub collaboration environment, and to support DH classes.
GNU Affero General Public License v3.0
27 stars 27 forks source link

GitHub Resources for Crises #92

Open ebeshero opened 8 years ago

ebeshero commented 8 years ago

I'm adding some GitHub resources to help quickly in case of crises. Please add to this as you find helpful resources!

Guidance for merge-conflicts: https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line/

ebeshero commented 8 years ago

Reverting, Rewinding and Rebasing: https://github.com/blog/2019-how-to-undo-almost-anything-with-git

RJP43 commented 8 years ago

Here are some more basic shell commands: https://www.siteground.com/tutorials/git/commands.htm

ebeshero commented 8 years ago

I needed to restore a directory I deleted months ago, and this site walked me through it: http://gitready.com/intermediate/2009/03/18/restoring-a-directory-from-history.html

ebeshero commented 7 years ago

When resolving a merge issue or a merge conflict, the Terminal or Git bash shell brings up a text editor named vim, and asks you to write a commit message in it. To complete the message, you need to type 'I', and type a commit message (no quotation marks needed). Then, to exit vim, you need to enter the following sequence:

ESC 
:wq

or try

ESC
and hold down
SHIFT + zz

See http://unix.stackexchange.com/questions/181280/how-to-exit-a-git-merge-asking-for-commit-message

ebeshero commented 7 years ago

Here's more on the weird little "vim" editor that pops up in Git Bash (windows) or Terminal (mac) sometimes when you're resolving a merge conflict. It's an old text editor that runs entirely from your keyboard (no mouse), and if you want to learn (as I do) how to use it effectively, here's a very helpful post on how to use it right: https://www.linux.com/learn/vim-101-beginners-guide-vim

ebeshero commented 7 years ago

A "merge tool" is software you can open from command line to help resolve a merge conflict when you need to hand-correct the files. We could really open those files in any text or code editor (including oXygen), but some software like Meld helps because it highlights differences and can make it visually easier to choose the alternates. To really understand what happens when Git does a merge, and to take the most advantage of Meld, I recommend taking a look at this article: http://blog.wuwon.id.au/2010/09/painless-merge-conflict-resolution-in.html

ebeshero commented 7 years ago

@RJP43 @ajnewton1 @jonhoranic @bsf15 @ahunker @Samantha-Mcguigan Let's say you've just done something magnificently stupid in your project files (as I just did), and you really want to just completely undo it without committing it the GitHub repo. You just want to return things to EXACTLY the way they were before you did the magnificently stupid thing. What you want to do is pull in the current state of your remote origin GitHub (the one in the cloud), and to do that, you would enter:

git checkout .

This uses the checkout command to make your local file directory reflect the current state of the remote origin repo. The . means basically "this" repo.