DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,864 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Basic Git Cheat Sheet
David Snyder
David Snyder

Posted on

Basic Git Cheat Sheet

Need to Know git commands

  1. git init (Initialize git repository)
  2. git checkout {branchname} - change the working branch
  3. git checkout -b {branchname} - create a branch and change the working branch into it
  4. git status - check for untrack and tracked files
  5. git add . - track changes in all files in the working branch
  6. git add {filename} - track changes in one file
  7. git commit -m β€œmessage” - save changes to local repository
  8. git remote add origin {remote url} - connecting to a remote repository
  9. git push origin {branchname} - push code from local to remote
  10. git push -u origin {branchname} - push code from local to remote on a branch that doesn't already exist on remote
  11. git merge {branchname} - merge changes from {branchname} into the current working branch

Note: Please remember not to work on master branch directly, always create different branches for different purposes.

Top comments (0)

Update Your DEV Experience Level:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›