https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf
These are not credentials, they're just who gets credit for commits.
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
git init projectname
cd projectname
"origin" is the name most commonly used for a remote
git remote add origin https://github.com/somascope/some-github-remote.git
git remote set-url https://github.com/somascope/some-new-url.git
Add an add'l remote to be able to get updates from what you forked:
(can be named anything, but 'upstream' is common)
git remote add upstream https://github.com/original-repo-you-cloned.git
git config --list (press 'q' to exit)
git config user.name
git config user.email
git remote -v to view remote addresses
git clone [url]
git clone [url] someFolderName
git log
git status
git diff
git add . (stages new and modified files, without deleted files)
git add -A (stages ALL)
git add -u (stages modified and deleted, without new files)
git commit -m "Your descriptive message"
git push origin master (push local branch master to remote branch master)
git checkout theDirectory
When you edited a file and save/close it, have not added/staged the file, and want to go back to before your edits.
git checkout -- some-file.js
git checkout -- .
When you added a file and now want to unstage it.
git reset some-file.js
git rm file-to-delete.js
git rm -r some/folder/toDelete
(delete the files)
git add -u
git commit -m "Deleted xyz files manually"
git diff (sha-id-one) (sha-id-two) -- filename.ext
i.e.: git diff da9dedee e3f28878 -- src/components/ConstrainedControl.vue
Get a list of changed files since a previous commit
git diff --name-only <starting SHA>
HEAD
git diff --name-only c2f85aa974367f79d8b2036d014916490cc63aae
HEAD
git tag v0.9
git tag -a v0.9 -m "Scrolling layout"
checkout tag v0.9
git push origin --tags
Syncing: https://www.atlassian.com/git/tutorials/syncing/git-pull
Note that you cannot make changes directly on a remote branch. Hence, you need a copy of that branch. Say you wanted to copy the remote branch fix-failing-tests, here's how you would do it:
git checkout -b fix-failing-tests origin/fix-failing-tests
git pull remote remote-bgranch
This is a combo of git fetch and git merge. it gets the updates from remote repository (git fetch) and immediately applies the latest changes in your local (git merge). This may cause conflits that oyu need to resolve manually.
git fetch
git remote -v (show remote details)
https://docs.gitlab.com/ce/gitlab-basics/start-using-git.html