Source tree là gì


As our new Bitbucket space station administrator, you need to be organized. When you make files for your space station, you’ll want to lớn keep them in one place & shareable with teammates, no matter where they are in the universe. With Bitbucket, that means adding everything lớn a repository. Let’s create one!


Initially, the repository you create in Bitbucket is going khổng lồ be empty without any code in it. That"s okay because you will start adding some files khổng lồ it soon. This Bitbucket repository will be the central repository for your files, which means that others can access that repository if you give sầu them permission. You will also copy a version of that repository to lớn your local system—that way you can update it from one repo, then transfer those changes to lớn the other.

Bạn đang xem: Source tree là gì


*

Do the following to create your repository:

Enter BitbucketStationSupplies for the Name field. Bitbucket uses this Name in the URL of the repository. For example, if the user the_best has a repository called awesome_repo, the URL for that repository would be https://bitbucket.org/the_best/awesome_repo.

Keep the rest of the options as is unless you want lớn change them:

Access level —Leave sầu the This is a private repository box checked. A private repository is only visible to lớn you & those with access. If this box is unchecked, anyone can see your repository.

Include a README? —If you recently created your account, this defaults khổng lồ a tutorial README. For the purposes of this tutorial, piông chồng either of the Yes options, that way you"ll start out with a tệp tin.

From Version control system, you can choose either Git or Mercurial. If you aren"t sure which one to go with, keep Git as your option.

Click Create repository. Bitbucket creates your repository & displays its Source page.


Step 2: Explore your new repository


Take some time to explore the repository you have sầu just created. To view the shortcuts available, press the ? key on your keyboard.


Click + from the global sidebar for common actions for a repository. Scan through the link in the navigation sidebar khổng lồ see what"s behind each one, including the repository Settings where you"ll update repository details và other settings. Cliông chồng the Commits in the sidebar. If you included a README, you"ll see one commit on that page.


Your repository is private & you have sầu not invited anyone to the repository, so the only person who can create or edit the repository"s content right now is you, the repository owner.


*

Step 2: Copy your repository and add files


Now that you have a place to add và nội dung your space station files, you need a way to get khổng lồ it from your local system. To phối that up, you want lớn copy the Bitbucket repository khổng lồ your system. Sourcetree refers to lớn copying a repository as "cloning" it. When you clone a repository, you create a connection between the Bitbucket server & your local system.


*

Step 1: Clone your repository lớn your local system


Use Sourcetree lớn clone your repository to your local system without using the comm& line.

As you use Bitbucket more, you will probably work in multiple repositories. For that reason, it"s a good idea to lớn create a directory to lớn contain all those repositories. So start by creating a directory on your local system và Hotline it repos.

From Bitbucket, go to lớn your BitbucketStationSupplies repository.

Click the Clone button in the top right corner. Bitbucket displays the Clone this repository dialog. 

*

From the Clone this repository dialog, click Clone in Sourcetree.

From the Clone New dialog box, update the Destination Path to /repos/bitbucketstationsupplies. This destination path refers lớn the directory you just created with the thư mục for the repository. The Name field remains the same with the folder name of the repository. 

*

Click the Clone button.


Congratulations! You"ve sầu cloned your repository lớn your local system.

Xem thêm: Những Điều Ít Biết Về Venezuela Là Đất Nước Của Hoa Hậu Với Khả Năng Chinh Chiến


Step 2: Create a tệp tin, add it locally, và push it khổng lồ Bitbucket


With the repository on your local system, you can start making a danh sách of all the supplies you need for your space station. To vị so, let"s create a tệp tin for your supplies.


As you work on this section, the images may look slightly different, depending on whether you are working with a Git or Mercurial repository.


Double-cliông xã the bitbucketstationsupplies repository in Sourcetree và notice that there is nothing to lớn commit from your local repository to the remote repository.

*

Use a text editor to lớn add the following three lines: space ice cream nerf darts telescope light shield

Save sầu the file as supplies.txt khổng lồ the bitbucketstationsupplies directory on your local system. The supplies.txt tệp tin now appears in Sourcetree since you created it in your local repository.

*

Now is the point where you prepare a snapshot of the changes before committing them to lớn the official history. From the options thực đơn of the supplies.txt file, select Stage file (for a Git repository) or Add file (for a Mercurial repository).

*
*

Cliông chồng the Commit button at the top to commit the file.

In the message box, enter "Initial commit."

*

Click the Commit button under the box. Your new file is now committed to lớn the project history. 

*
Up until this point, everything you have sầu done is on your local system & is invisible to lớn your Bitbucket repository until you push those changes to lớn your remote Bitbucket repository.

From Sourcetree, click the Push button lớn push your committed changes. Pushing lets you move one or more commits to lớn another repository, which serves as a convenient way to publish contributions.

*

From the dialog box that appears, your next step depends on whether you are using Git or Mercurial:

Git–Under the Push? column, select the main branch lớn indicate that you are pushing that branch khổng lồ origin & click OK.

*

Mercurial–Everything is automatic, so all you have to lớn vị is click OK.

Go lớn your BitbucketStationSupplies repository in Bitbucket.

If you click Commits in the sidebar, you"ll see your commit in the repository. Bitbucket combines all the things you just did inkhổng lồ that commit & shows it to you.

If you click Source in the sidebar, you"ll see your tệp tin in the repository, the supplies.txt file you just added.

*


To add your supply request tệp tin, bởi the following:

From your BitbucketStationSupplies in Bitbucket, click Source khổng lồ open the source directory. Notice you only have one tệp tin, supplies.txt, in your directory.

*

A. Source page: Click the link to open this page.

B. Branch selection: Pichồng the branch you want lớn view. 

C. More options button: Cliông chồng to lớn open a thực đơn with more options, such as "Add file".

D. Source file area: View the directory of files in Bitbucket. 

From the Source page, cliông chồng the More options button in the top right corner & select Add file from the thực đơn. The More options button only appears after you have sầu added at least one file to lớn the repository. A page for creating the new file opens, as shown in the following image.

*

A. Branch with new file: Change if you want to lớn add tệp tin lớn a different branch.

B. New file area: Add nội dung for your new file here.

Enter supplyrequest in the filename field.

Select HTML from the Syntax mode danh sách.

Add the following HTML code lớn the text area: We are requesting additional supplies. Please skết thúc us the following:

space ice cream nerf darts telescope light shield

Click Commit. The Commit message field appears with the message: supplyrequest created online with Bitbucket.

Xem thêm: Cho Trẻ Ăn Dặm Kiểu Mỹ Khoa Học Và Hiệu Quả, Giới Thiệu Phương Pháp Ăn Dặm Kiểu Mỹ

Click Commit under the message field.


You now have sầu a new file in Bitbucket! You are taken to a page with details of the commit, where you can see the change you just made: 


Chuyên mục: Blogs