untracked and trcaked changes
-
untracked – changes are done or files edited or created in working directory is untracked files
-
tracked – changes ready for commit (staging files are ready for commit)
git restore --staged <files path>
git logs
# shows all commits and changes
git log
## all details in single line for every commit
git log --oneline
### get log for specific branch
git log <branch name>
## graph
git log --graph <branch name>
- Refer sample repo- https://github.com/spring-projects/spring-petclinic/branches/all
Move Between Branches
- changes or switch exits branch
## Switch branches:
git switch <name>
OR
git checkout <name>
## Create a branch:
git switch -c <name>
OR
git checkout -b <name>
## List branches:
git branch
## List branches by most recently committed to:
git branch --sort=-committerdate
## Delete a branch:
git branch -d <name>
## Force delete a branch:
git branch -D <name>
Task:
- create branches names dev, stg, qa, main/master
- add different files in all branches
- Try all above branch commands
