git-basics
  • Introduction
  • Branching
  • Stash
Powered by GitBook
On this page
  • Important Commands
  • Revert Commit ( not pushed to remote yet )
  • Not pushed yet, but want new changes to go with previous added commit

Was this helpful?

Introduction

NextBranching

Last updated 4 years ago

Was this helpful?

Distributed version control

Install Git -

git --version

Important Commands

git init // initialize new repo
git add index.html // add single file to staging area ( take snapshot, uploaded to truck )
git commit -m "1st commit" ( save changes give some name, send truck to warehouse )
git log ( show commits )

Revert Commit ( not pushed to remote yet )

git log ( show commits hash, copy hash you want to revert)
git reset --hard 12378213515312 ( reset all chages would be gone )
git reset --soft 12378213515312 ( revert commit message, change would be retained )

// OR
git reset HEAD~1 --soft ( revert to previous commit )

Not pushed yet, but want new changes to go with previous added commit

git add .
git commit --amend
https://git-scm.com/