I figured out the steps but seems cumbersome, take bitbucket
for example, suppose i already have a project called prj
prj-bz
git remote add prj-bz https://blah...
prj-bz
git push prj-bz prj-bz
to let local repo and remote one connected.I checked out some git books but seem none cover this. Any more efficient way to do this?
Generally, people usually do one or the other Fork or Branch. It sounds like you are making a Fork of a repo, then making a branch in the fork with the same name. If you're using a Pull Request to put data back in to the main repo, you don't need to do both. Pick one of the two workflows:
git clone https://bitbucket.org/username/repo-fork.git
git commit -m "some work done"
, git push -u origin master
OR
git clone https://bitbucket.org/username/repo-fork.git
git checkout -b my-branch
git commit -m "some work done"
git push -u origin my-branch
With the branch method, I'm assuming you have rights to write to the main repo. If not, you'll want to stick to the fork method. There are more workflows out there too. Bitbucket also has a doc explaining this as well as one on Atlassian's website with a bit more depth on Git workflows.
For creating new branch we will use: (using this command A new branch will create and the branch status will also change with newly created branch)
git checkout -b branch-name
And for pushing the changes we can run following commands:
git add .
git commit -m "with meaningful comments"
git push origin branch-name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With