git usage on Mac (ii)

Source: Internet
Author: User
Tags using git git commands

Reprint address Please indicate: http://blog.csdn.net/android_ls/article/details/47209079
Application scenario: A new company that uses the code management tools of Git, and how you can use Git and team collaboration smattering in your company (for example, if you've used Git's graphical management tools or the GIT command-line operation is unclear), then this article tells you How to work with a team in a company using Git (for example, in my current Android project).
First, from the server-side git code warehouse, get the code on the specified branch to local.
1. Create a folder (directory) locally and go to the directory

cd /Users/android_ls/Documents/Boluomi/android (我本地创建的目录是:Boluomi/android)

2. Execute the following command (patiently wait for the code to download)

clone http://xxx/bolome-android

Where Http://xxx/bolome-android is the address of the code warehouse where the company's Android project resides
3. Enter the local directory where the project is located

cd bolome-android/

4. View current Branch

git branch

5. Switch to the current working branch

release-2.0 (其中release-2.0 为当前的工作分支)

6. Get to the local warehouse

 git pull

Second, the git command used in the company's weekdays (the process of committing the code to git)
1. View local changes to those files

git status

2. Back up the contents of the current workspace, read the relevant content from the most recent commit, and make the workspace guarantee consistent with the last commit. At the same time, save the current workspace content to the git stack.

git stash

3. Get updates from the remote repository

4. Read the last saved content from the GIT stack and restore the contents of the workspace. Because there may be multiple stash content, the pop reads the content from the most recent stash and recovers it by using a stack to manage it.

Note: After this step of git stash apply is complete, there may be a conflict on the local remote library that needs to be resolved manually.
5. Add all the change content

add

6, submit to the local warehouse

commit -m"这里是注释"

7. Synchronize the local warehouse to the remote repository

push 分支名称

8. If your company asks you to use Git Review (git Review can be installed under Baidu), then synchronize the local repository to the remote repository command as follows:

9. Some of the other commonly used commands:

log // 查看变更LOGgit diff 文件名 // 对比本地文件与库上文件的区别clear // 清空所有备份git branch -a // 查看所有分支git checkout -b dev // 新建分支,其中dev为分支名称git branch // 查看当前分支

Talking about this, if you're just a regular employee of the company, basically these common git commands are enough for you to use.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

git usage on Mac (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.