-add user details
git config --global user.email "phani@soft.com"
git config --global user.name "phani"
-create a git project
git init
-check the project files and folders
git status
-to add file to git
git add FILE_NAME
-to commit to git repo
git commit -m "FIrst commit"
-to see commit list
git log
-list of branches
git branch
git branch --all
--change one branch to another
git switch BRANCH-NAME
--merge branch changes
git merge BRANCH_NAME
--If we directly checkout specific commit instead of brach then we end up with HEAD Deatach issue
git checkout HASH-CODE-COMMIT
--In the above case we have to create a brach for the detached head
git branch hashcommit
--rebase used to merge all commits from one brach to another branch.It does not create a new merge commit like git merge.
In summary, git merge creates a new merge commit to combine changes from different branches, while git rebase rewrites the commit history by moving or combining commits onto a new base commit.
git rebase TARGET-BRANCH-NAME
Ex:
git checkout feature
git rebase master [Git will replay the commits from the feature branch on top of the latest commit in master, resulting in a linear history.]
-tag is nothing but creating a label to commit
git tag tag_name
git checkout tag_name
git pull
git push
git fetch
git merge