perrymant / learning-git

Learn Git and GitHub by contributing to this repo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

learning-git

Learn Git and GitHub by contributing to this repo!

In the FAQs below we've got a bunch of questions without answers. Do some Googling to find these answers, and create a pull request to have your answer listed here. See the CONTRIBUTING document for more information on how to contribute to this repo.

If you have any other questions not listed here, please raise a PR to have it added. There's no need to answer it unless you want to.

Git FAQ

  • Q: I made a typo in my commit message, how can I amend it?

  • Q: Can I see a log of the commits that have been made on this repository?

  • Q: What are some Graphical User Interfaces(GUI, pronounced "gooey") that I can use with Git?

  • Q: I have accidentally staged something I don't want to commit. Can I reset only that file?

  • Q: I would like to see what the repo looked like at a given version. How can i checkout that version?

  • Q: How can I see a diff of what's changed in the files I've changed but not committed? How about just the files I've staged?

  • A: git diff shows the unstaged changes. git diff --cached shows the staged changes.

  • Q: Can Git show me what's changed in the previous commit?

  • Q: How can I add only parts of a file I've changed?

  • Q: How can I revert a commit?

$ git commit -m "Something terribly misguided" (1). $ git reset HEAD~ (2). << edit files as necessary >> (3). $ git add ... (4). $ git commit -c ORIG_HEAD (5). comment from: https://stackoverflow.com/questions/927358/how-to-undo-the-most-recent-commits-in-git.

  • Q: I keep accidentally adding files I don't want to commit (e.g. compiled code, files with passwords etc.), how can I ignore these files?

  • Q: What's the difference between git pull and git fetch?

  • Q: How can I clean the repo of any untracked files, i.e. removing new, unstaged files without manually rming all of them?

A bit more challenging questions:

  • Q: Windows behaves differently to most operating systems, in particular in how it handles line endings (Windows uses CRLF whereas all other operating systems use just LF). How can I make sure that all commits use the same line endings? What are the consequences of not caring about this?

  • Q: I need to change branch, but Git won't let me because I have modified some files. I don't want to commit these yet, can I stash them away for later?

  • Q: How can I make it so that git diff also displays the diff of new file's I've introduced?

  • Q: What's the difference between a merge and a rebase?

GitHub FAQ

  • Q: How can I see who wrote a specific line in a file, so that I can blame the right person?

  • Q: How can I add collaborators to this project?

  • Q: How can I create my own organisation?

  • Q: How can I create a project issue tracker?

  • Q: How can I create a website for my repository? (Author's note: This violates some sort of universal law: it's free, easy and fast!)

A bit more challenging questions:

  • Q: How can I make it so that GitHub remembers my computer, and doesn't ask for username and password all the time?

  • Q: What's the difference between cloning over HTTPS and SSH?

  • Q: Would you recommend a different method (simpler perhaps?) for repo maintainers to contribute?

  • Q: What are some common branching strategies? What strategy does our CONTRIBUTING.md file recommend?

About

Learn Git and GitHub by contributing to this repo

License:MIT License