- 
- Install git
 - Configure name, email for commits
git config --global user.name "Your name" git config --global user.email [email protected]
 - Create ssh keys using the 
ssh-keygencommand - Add the public key to you Github account
 
 - 
git init
 - 
git add <file_name> # add a single file git add <folder_name> # add a folder git add . # add everything under current directory
 - 
git commit -m "Commit message" - 
- Create a 
.gitignorefile and add files/folders or patterns to exclude - Example
echo .env > .gitignore
 
 - Create a 
 - 
git branch # list all local branches git branch -a # list local and remote branches git checkout <branch_name> # checkout existing branch git checkout -b <branch_name> # create a new branch and checkout
 - 
- 
Merge (read more)
git checkout <base_branch> git merge <other_branch>
 - 
Rebase (read more)
 
 - 
 - 
git clone <repo_url>
 - 
git remote add <remote_name> <remote_url>
 - 
git pull <remote_name> <branch_name> # push to a specific branch
 - 
git push <remote_name> <branch_name>
 - 
git stash # stash all local changes git stash pop # restore stashed content (might cause conflicts)
 
          Last active
          April 4, 2024 10:28 
        
      - 
      
 - 
        
Save Keshav13142/c2004a6cc87cacb3dbbba917949f8bba to your computer and use it in GitHub Desktop.  
    Git basics
  
        
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment