learn bitbucket - vidyasekaran/current_learning GitHub Wiki
Follow this tutorial
Below has examples :
https://www.atlassian.com/git/tutorials/setting-up-a-repository
https://www.atlassian.com/git/tutorials/learn-git-with-bitbucket-cloud
Find out which remote branch a local branch is tracking
https://stackoverflow.com/questions/171550/find-out-which-remote-branch-a-local-branch-is-tracking
E:\spring-cloud-streams-kafka-payment-router>git remote show origin
To know which branch
E:\spring-cloud-streams-kafka-payment-router>git branch
E:\spring-cloud-streams-kafka-payment-router>git branch -av
Cut a new branch
https://www.atlassian.com/git/tutorials/learn-branching-with-bitbucket-cloud
E:\spring-cloud-streams-kafka-payment-router>git branch develop
Swicth branch from master to develop
E:\spring-cloud-streams-kafka-payment-router>git checkout develop
E:\spring-cloud-streams-kafka-payment-router>git branch
Add some changes and push it to develop branch
E:\spring-cloud-streams-kafka-payment-router>notepad pom.xml
E:\spring-cloud-streams-kafka-payment-router>git status
E:\spring-cloud-streams-kafka-payment-router>git add pom.xml
E:\spring-cloud-streams-kafka-payment-router>git commit -m "pom changes in develop"
E:\spring-cloud-streams-kafka-payment-router>git push origin develop
E:\spring-cloud-streams-kafka-payment-router>
Make changes in develop directly in git and try to add some files in local and then push - you will need to pull before u push
git pull origin develop
you will get below error
E:\spring-cloud-streams-kafka-payment-router>git push origin develop
To https://bitbucket.org/techguru1008/spring-cloud-streams-kafka-payment-router.git
! [rejected] develop -> develop (fetch first)
error: failed to push some refs to 'https://bitbucket.org/techguru1008/spring-cloud-streams-kafka-payment-router.git'
Now make changes - add - commit - pull - push
git push origin master
git: updates were rejected because the remote contains work that you do not have locally
How to change the URI (URL) for a remote Git repository?
https://stackoverflow.com/questions/2432764/how-to-change-the-uri-url-for-a-remote-git-repository
git remote set-url origin new.git.url/here
Create a repository in bitbucket and clone it then add files and commit it.
-
click on https://bitbucket.org/techguru1008/
-
click on Create repository
-
Provide a repository name which you will need to also create in local example: spring-cloud-streams-kafka-payment-router
-
git clone url
-
add new files
-
git add .
-
git push
git stash - How to Save Your Changes Temporarily
https://www.git-tower.com/learn/git/faq/save-changes-with-git-stash/
Cut a branch make changes and merge to master
https://www.atlassian.com/git/tutorials/learn-branching-with-bitbucket-cloud
E:\spring-cloud-streams-kafka-payment-router>git remote show origin
E:\spring-cloud-streams-kafka-payment-router>git branch (in develop branch now)
E:\spring-cloud-streams-kafka-payment-router>git branch test (from develop i cut a branch)
E:\spring-cloud-streams-kafka-payment-router>git fetch && git checkout test (git retrieve latest meta-data info & switched to test branch)
E:\spring-cloud-streams-kafka-payment-router>notepad pom.xml (make changes to all files)
E:\spring-cloud-streams-kafka-payment-router>git commit -m "pom.xml changed"
E:\spring-cloud-streams-kafka-payment-router>git push origin test (push changes to test)
Now changes are pushed so now create a pull request select "test" in left and "master" on right
Click +> Create a pull request. You can see your test-1 branch as the source branch and master in the destination branch.
Click Create pull request.
Click Approve in the top left of the page. Of course in a real pull request you'd have reviewers making comments
Click Merge.
Delete a branch and pull master into local working branch
E:\spring-cloud-streams-kafka-payment-router>git branch develop master
- test
E:\spring-cloud-streams-kafka-payment-router>git checkout master
E:\spring-cloud-streams-kafka-payment-router>git pull
E:\spring-cloud-streams-kafka-payment-router>git branch -d test
git fetch - git fetch is the command that tells your local git to retrieve the latest meta-data info from the original (yet doesn't do any file
transferring. It's more like just checking to see if there are any changes available). git pull on the other hand does that AND brings (copy) those
changes from the remote repository
Bit Bucket git commands cheat sheet
C:\Users\shant\Downloads\SWTM-2088_Atlassian-Git-Cheatsheet
Branching Strategy
https://www.youtube.com/watch?v=Bg8tiOLZw4A
Have 3 branches (test,qa,prod) for 3 environments say test, qa and prod
do changes in test once finalized create pull request and merge it to qa branch and then allow users to test
if works fine do a pull request and merge code from qa to prod