Knowledge/Development/Git
2024-10-07 21:05:26 +02:00
..
Github New update 2024-09-19 20:17:24 +02:00
README.md Adding updated git docs 2024-10-07 21:05:26 +02:00

Git

Git setup

  • git config --global user.name "John Doe" - configure global user
  • git config --global user.email johndoe@example.com - configure global user email

Add new commit

  • git init - initiallize repository
  • git add README.md - add file/s to repository
  • git commit -m "first commit" - commit file
  • git branch -M main - switch branch to main

Information

  • git status - view current files status

Repository changes

  • git reset HEAD~1 - revert to previous commit
  • git reset --hard - goes to the previous commit and removes all changes

Branches

  • git branch [name] - create new branch
  • git checkout [name] - switch to it

Git merge and rebase

  • ``

Remote repository push

  • git remote add origin https://github.com/foglar/[name].git - add remote url
  • git push origin master - push master branch

Video