Git Code Samples

    Essential Git Commands
  1. initialize existing git repo -- git init
  2. add changes from local to stage for uploading -- git add .
  3. committing changes from local to stage for committing -- git commit -m "notes"
  4. pushing changes to remote -- git push -u origin main
  5. in case remote is ahead of local and you don't want to merge remote with local -- git push -f origin master
  6. checking for branches -- git branch (main, master, my-feature)
  7. changing branches -- git checkout master (will change from active branch to master)
  8. merging changes from remote to local -- git branch -d my-feature
    Error Messages
  • src refspec master does not match any - This means that the remote repository is not available