Git Basics: Commands & Terms #720
jgbourque
announced in
Published Guides
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Git Commands
Setup & Basics
git --version– check to ensure proper installationgit init– create a local repo heregit status– show changed filesWorking with Existing Repos
git clone [URL]– copy remote repo locallygit remote -v- displays name of remote repoBranching & Updating
git switch– switch between branchesgit switch-c [branch] – create & switch to new branchgit pull– get latest changes from remotegit branch– list local branchesgit branch -a– list all branches (local & remote)Staging & Discarding
git add .– stage all changesgit add <file>– stage select filesgit restore .– discard unstaged changesgit clean -fd– remove untracked files/dirsCommitting & Pushing
git commit -m"msg" – commit staged changesgit push --set-upstream origin [branch]– push changes to a new branch for the first timegit push origin [branch]– push feature branch changesHistory & Reset
git log– commit listgit log --oneline– short/condensed view of commit listgit reset --hard [hash]– revert to a specific commitGitHub/Git TERMS
Repository (Repo) - On GitHub and locally, it’s the project folder with all code and history.
Fork - On GitHub, a copy of someone’s repository that is stored on your own account.
Clone - On your computer, a local copy of a GitHub repo you can work on offline, but can still stay connected with the GitHub repo.
Branch - On GitHub and locally, a separate version of the project for features/fixes without touching the main code.
Commit - Created locally, visible on GitHub after pushing; a saved snapshot of changes with a message.
Pull Request (PR) - On GitHub, a request for others to review and approve merging your branch’s changes into another.
Merge - On GitHub, after PR approval, combine your branch’s changes into the main project.
Collaborator - On GitHub repo settings, a person who can directly change a repo and review code.
Issues - On GitHub’s “Issues” tab, a place to discuss and track bugs, tasks, or ideas.
README - On a repo’s main GitHub page, a file explaining the project, how to use it, and how to contribute.
Beta Was this translation helpful? Give feedback.
All reactions