git status
git init
git log
git log --oneline
git branch
git branch 'branchname'
git add .
git add 'filename'
git commit -m "comment"
git switch 'branchname'
git merge 'branchname'
git diff
........renaming-branch----
git switch 'branch_to_rename'
git branch -m 'new_name'
------------git-restore-cmd-------------------------
git restore // remove uncommited text and restore file to last successful commit
git restore --source HEAD~2 myrestore.txt // this will go back to 2 commits of myrestore.txt
git restore --staged <filename> // this wil remove file from staged area
--------------------git-reset-----------------------------------
git reset 798927a //saves files
------------------------------------------------------------------------
echo "# Todo_App_py" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/myname/{repository_name}.git
git push -u origin main
git remote add origin https://github.com/myname/{repository_name}.git
git branch -M main
git push -u origin main
If you want to switch to an existing branch called feature1, you can simply run:
git switch feature1
If you want to create a new branch called feature2 based on the current branch and switch to it, you can run:
git switch -c feature2
If you want to switch to a specific commit with the hash 1234567 without creating a new branch, you can run:
git switch --detach 1234567
If you want to merge your current branch into master before switching to it, you can run:
git switch -m master
If you want to force-switch to another branch called feature3 and discard any uncommitted changes in your working directory and staging area, you can run:
git switch -f feature3