Skip to content

Instantly share code, notes, and snippets.

@cdhiraj40
Last active October 13, 2023 09:54
Show Gist options
  • Save cdhiraj40/41cc368cd76b2dfec38a413f8f11c1a6 to your computer and use it in GitHub Desktop.
Save cdhiraj40/41cc368cd76b2dfec38a413f8f11c1a6 to your computer and use it in GitHub Desktop.
This file has bunch of instructions, commands and useful links which I use for my git basics talk. This makes it easier for audience to refer to commands or any links.

Git Basics

Note: The whole talk flow is mentioned here: https://talks.cdhiraj40.dev/git-basics/talk-content.html

Git Download link

https://git-scm.com/downloads

Git Commands - 1

  1. Run git init command
git init
  1. Run git status command
git status
  1. Add a specific file to staging area.
    File path should be relative to your project's path
  • Correct path => src/lib.rs
  • Wrong path => user/windows/my-cool-project/src/lib.rs
git add <file path>
  1. Run git commit
    Replace commit message with a small message which is descriptive of the changes. Make sure its small and on-point.
git commit -m <commit message>
  1. git log
git log
  1. git stash
git stash

Git Commands - 2

  1. Connect remote repository with local one.
    Specify a remote name which you would like to have and replace link with your remote project link.
git remote add <name> <link>
  1. Verify new remote
git remote -v
  1. Push the changes from local to remote.
git push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment