How to edit existing files on Bitbucket using Git



Do you want to use a version control system to work within teams or for your own control?

You might have two main options: Github and Bitbucket. I prefer Bitbucket because of their interface.

Anyway, if your team already have an ongoing project within an existing repository, this tutorial will help you to upload changes from your local machine.

1. First of all install Git

Download Git at this page.

For this tutorial we are going to use command line.

2. Cloning

Clone the existing file from the repository online to your local machine. You cannot have a folder with the same name.

To clone, make sure you know the address to your Bitbucket repository. It is located at this top part of the screen, at the overview page of the online repository.

Copy it, and then open Git Bash and type git clone. Right click at the window, you will find an option to paste.


3. Replacing files and adding

Once you clone, you will see that there is a new folder with the cloned files. Access this folder and replace the files with the ones that you have edited and want to replace at the online repository.

You can run git status to see what happened.

Make sure you when to the correct directory where you folder is. You may need to use cd name-of-the-folder.

Now, we are going to add. When you add, all changes are going to the staging. Which means that they are half way from being actually updated.

Type git add .

4. Commit

We need to commit these added files, so people can know which kind of changes you’ve made.

Type git commit –am “commit you want to make”

5. Push

Check your status right now typing git status.

Now we are finally going to push the added files.

Type git push

You will be requested to answer your password at Bitbucket.

Check now your online repository to make sure everything is fine.

Estefani Rangel

About the author

Estefani Rangel is a web developer graduated at the New Media and Web Development program at BCIT in Vancouver. Her passion is Front-End development.

She is always excited with sunny days, and it is quite impossible to keep her indoors if you don’t offer her a code editor to play with.