1. Git clone
- always pulls from master
2. Branch create/switch/download
git checkout //swtich branch
- IE_Migration
git checkout -b //-b create branch
git checkout [file name]
Branches are created under the current branch (default master)
Master <--> Dev Common Branch-->
|
----> Dev1 Branch
3. Pushing
git push origin [branch name]
-u upstream
Note: so we are sure we are comitting on the right branch
***Always pass origin and [branch name] to be sure you are pushing on the right branch ****
4. git status
- status of local repo
5. Comitting specific files
git add [file name with complete path]
git commit -m "commit text"
6. git branch // to view all the branches
7. Pull and fetch
git pull // pull the files and automerege
git fetch // doesnt do automerge
8. Merging
MasterBranch ---> DevBranch
git checkout Dev
git pull // to update on the branch
git checkout MasterBranch
git pull
git merge DevBranch
9. Ways for merging
1. create seperate branch per functionality
2. Tagging
git tag -v 1.0.0 [tagName]
3. Milestone
10. git reset -hard //to get everything from server. all local changes will be gone.
Other
Git rebase
- always pulls from master
2. Branch create/switch/download
git checkout
- IE_Migration
git checkout -b
git checkout [file name]
Branches are created under the current branch (default master)
Master <--> Dev Common Branch-->
|
----> Dev1 Branch
3. Pushing
git push origin [branch name]
-u upstream
Note: so we are sure we are comitting on the right branch
***Always pass origin and [branch name] to be sure you are pushing on the right branch ****
4. git status
- status of local repo
5. Comitting specific files
git add [file name with complete path]
git commit -m "commit text"
6. git branch // to view all the branches
7. Pull and fetch
git pull // pull the files and automerege
git fetch // doesnt do automerge
8. Merging
MasterBranch ---> DevBranch
git checkout Dev
git pull // to update on the branch
git checkout MasterBranch
git pull
git merge DevBranch
9. Ways for merging
1. create seperate branch per functionality
2. Tagging
git tag -v 1.0.0 [tagName]
3. Milestone
10. git reset -hard //to get everything from server. all local changes will be gone.
11. Reset branch as remote git fetch --prune git reset --hard @{upstream} git clean -d --force 12. Branch : team/cotr git add . git commit -m “DD-17384:Added extra parameter” git push origin HEAD:refs/for/team/cotr git commit --amend --no-edit git log -p -2
Other
Git rebase
1 comment:
create dev branch and commit+push changes:
create dev branch from team branch:
git checkout team/tbranch
git fetch
git pull
git checkout -b dev/DD-XXXXX
commit+push changes on dev branch:
git status
git add .
git commit -m "DD-XXXXX Some explanation"
git push origin dev/DD-XXXXX
merge changes from dev branch to team branch:
git checkout team/tbranch
git pull origin team/tbranch
git merge --squash dev/DD-XXXXX
git status
git add .
git commit -m "DD-XXXXX Some explanation comes here"
Do [git commit –amend -m "message"] if additional changes need to be pushed to same CR?
git push origin HEAD:refs/for/team/tbranch
Last line raises a CR on gerrit
Post a Comment