Query on Bitbucket

Version control: If I have 4 files Test1.c Test2.c Test3.c & Test4.c for two files I have to attach Version-1. For remaining two files I have to attach Ver-2.

For all the files I have to attach Ver-3.

How to check-out (pull) or check-in (push) wrt Version 1/2/3.

5 answers

1 accepted

As far as I know, Git doesn't allow you to use most of the requested commands (tag, checkout, pull, push) on individual files.

It sounds to me like you should check out the free online Git book. It should provide you the information you need, plus help you understand the basic terminology. In Git, checkout is not the same as pulling, and "checking in" (aka committing) is not the same as pushing. Also, "attach" is not a term in any versioning system I've used - I think you mean "tag".

In the book, I recommend focusing on 1.1-1.3, then chapters 2 and 3.


thanks for the suggetions

I would also like to know how Locking the required project/branch folders/files can also be donre in bitbucket.

I mean If one user checks out some code it should not be modified or updated by another user or even should not be cloned to there local repositories.

Hi Rahul,

In Bitbucket, under (Settings > Repository Details) please make sure the following is checked:

Access Level [x] This is a private repository

As well as that, you can specify (Settings > Access Management) to an specific user or to a group

Furthermore, you can provide access through the (Settings > Deployment Keys) where you are going to add a public key in Bitbucket and provide a private key to the user you want to grant access to your repository. Please, refer to the free online Git book mentioned by Seth Foss, section 4.3 Generating Your SSH Public Key

Kind regards,

On the other hand, if you are looking for automatic, temporary locks (only allow one person to edit any branch at a time), that is not possible.

Hi Seth,

So You mean to say If I checkout branch from master branch which has 3 files at the same time other user can check out same files to his local machin, we cant stop them by any means?

If I checkout files from central repo to my local machin does any user who has access to that central repository can access my local repo. And can I retrict other user of my team from doing checkout for same branch(files which I have in my local repository)?

As I am new to this

This foolish questions might irritate you but please give me a clarification!!!!

Not irritating at all. I'll try to provide clear answers.

There is no way to automatically restrict branches to be checked out by only one person. So, if you check out the master branch to your machine, other users can also check out the master branch to their macines.

(Git commands bolded.) Cloning a repository will NOT give other users access to your local repository. If you and another user both clone the central repo and checkout the "master" branch, then you'll each have copies of the central repository's "master" in your respective local repositories. If you both make changes and commit to your local "master" branches, then your branches will be different. To get in sync, changes need pushed to the central repository. Let's say that the other user pushes first. That will put the central repository in sync with his local one, and the central repository will be out-of-sync with YOUR local one. To remedy this, you would do a pull, which will fetch any changes to the remote repository (your friend's pushed commit) and merge those changes into your checked out branch. This will result in a new commit in your local repo (the merge). At this point you will be able to push your local changes to the central repo. Your friend can pull those changes, then all three repositories will be in sync.

If you want to reduce the frequency of pulling and merging, you can establish a policy (enforcable with self-discipline) that all major changes should be done in local-only branches (not master). These would not be available for anyone to check out except the original creator unless or until the creator pushes the branch to the central repository.

What do you mean "attach", and what are you trying to do?

how to pull/push a file of version 1 or version 2 or version 3?

Ok...and is this a Git or Hg repository?

Yes it is a git repository

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

699 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot