【Git+Source Tree使用教程之一】commit & push

About SourceTree

SourceTree is a powerful Git and Mercurial desktop client for developers on Mac or Windows. In this tutorial, we're using OSX 10.9.5 and SourceTree 2.0.4.

AboutSourceTree2.png  



GitHub

Here is our GitHub repository.

bogo-stree-repo.png  



Cloning from GitHub

Let's clone the repo:

CloneFromURL.png  

SourceTreeCloneRepoDialog.png  

SourceTreeGitMasterBranch.png

Staged & Unstaged

If we make a new file on our local machine, we'll have "Uncommited" changes:

uncommittedChanges.png  

We can put the file into staging either by checking "Unstaged files" or:

StagingFileMethod2.png  
StagingMyfile01.png  



commit to a local repo

Now commit the file in the staging area:

Working_myfile01_just_before_commit.png  

If we press "Commit" on the top menu, we get the following:

Committing_myfile01.png  

Fill in out comment, and the hit "Commit" button:

AfterCommitMyfile01.png

Now, we can see our local repo is 1 ahead of remote repo (origin/master) 



pushing to GitHub

After adding two more files to our local repo, we want to push to a remote repo:

TheFilesInLocalRepo.png  

Before we do Push, we need to Pull first, so hit the Pull on the top menu:

PullingBeforePush.png  

Now, press "Push" on the top menu:

Push3Button.png  
PushDialog.png  
AfterPush.png  

As we can see, now our local and remote repositories are in sync!

In_Sync.png  



GitHub after the push

After our push, the GitHub looks like this:

GitHubAfterPush.png



Source Tree Preferences

In this tutorial, we used the preferences as shown below:

SourcePreferencesGeneral.png  
SourceTreePreferencesNetwork.png  



原文链接: http://www.bogotobogo.com/cplusplus/Git/Git_GitHub_Source_Tree_1_Commit_Push.php
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值