Basic Git Strategy
Pull & Push Command:
git add .
git commit -u "changes"
git pull
git push
Create New Remote Instance:
git init
git remote add origin repo_url
create new branch:
git branch branch_name
cherryPick:
to remove wrong commit and revert changes apply on other branch
git rebase & git merge conflicts ----pending
How to merge to branch?
suppose there are two branch first one is production and the second is staging
and you are working on staging branch
then
step 1: git branch staging
step2: git checkout staging
step3: git add .
step4: git commit -m "update task list"
step5: git checkout production
step6: git merge staging
step7: git push -u origin master
It's done
another git command you can read about this be a good practice
git log --oneline --all --graph
git cherry-pic commit_id
git push -u origin production
note: here origin is the default remote instance.
git checkout -b branch_Name
git revert id
// to delete git branch
git branch -d branch_name
// to force delete git branch
git branch -D brach_name
CherryPick: ==>
If I have made changes or commits in wrong branch, we don't want these commits or not want to merge the whole branch then we can revert these commits and apply to the another branch
git branch developer
git checkout developer
git add .
git commit -m "msg"
git checkout master
git log --oneline --all --graph
git cherry-pick commit_id
git push -u origin master
#Basic git strategy example
#continuous delivery
# best practices
#git branching strategy
Comments
Post a Comment