Could you point if it's possible to clone a repository  (Bitbucket  on my case) from master with a named way ?

Eduardo Fuerte
Eduardo Fuerte used Ask the Experts™
on
Hi Experts

Could you point if it's possible to clone a repository  (Bitbucket  on my case) from master with a named way ?

What I mean is something like:

git pull origin master  (name)

Or the name is only possible to link a name when commiting (f.e.).

Thanks in advance!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jeffrey Dake Senior Director of Technologyy

Commented:
I do not think there is a way to clone the repository of master but then name it something else.  Can I ask more on what you are trying to accomplish here?  Usually you would create a new branch to work on and have that be named what you are working on.  Then when that is finished you would merge that into the master branch.
Eduardo FuerteDeveloper and Analyst

Author

Commented:
Hi

What is needed is to create a branch with a name, like you replyed:

Something like:

git checkout -b CT192
(Been  CT192 been the name of the branch to be created)

So, after some changes at the project's code:

1) git add -A
2) git commit -m "comments"
3) git push CT192

So it's done on the branch directly.

I just don't know if it's necessary all the commands above (1,2,3) on a branch.

And then, if everithing OK merge this branch at Master, at the end.

Could you revise any misconceptions here?
Senior Director of Technologyy
Commented:
There is some documentation on Atlasians site here: https://confluence.atlassian.com/get-started-with-bitbucket/create-and-push-a-branch-862720857.html

Git can be a little confusing but basically can be broken down like this.

When you do the checkout command, you are checking out a particular branch.  In your example CT192 is a new branch that you have made at a point in time from master.  Any new code that is pushed to master will not be in your CT192 unless you merge master into it.  Branches are great for working on new projects.  Every project we work on here we do in a branch and then merge into master once it is completed and tested.

The other commands are for how you commit changes.  Git add is how you add the files you want to commit into a staging area.  Imagine you have changed 10 files, but are only ready to commit 2.  You would do get add on those files so they are staged.

git commit then commits that file.  The way git works though is it is committed to your local repository on your machine, so it is now in your repository, but not pushed up to bitbucket itself (where your shared repository with other developers are).

Then when you do git push it will push those changes up to the origin repository (ie bitbucket).

Then when the project is completed you would merge it into master so that all new branches created off of master would have your new code.  Since you say you are using bitbucket, I would recommend using their "Pull Request" process, since you can do a onclick merge from there.
Eduardo FuerteDeveloper and Analyst

Author

Commented:
Jeffrey

Much better now.

Thank you for your guidance!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial