Git simple Workflow

Source: Internet
Author: User

Operations on the server
1. Modify the project file on the server:
In ubuntu, open the terminal
Enter SSH, open the putty window, and log on to the server,
Putty is the local window connecting to the server. All operations performed in putty are performed on the remote server. Therefore,
Enter the file directory of the project and run the CD command (eg: CD workspace/test)
Then, find the current directory of the file to be modified and execute "Vim file" (or the relative path of the vim file) to edit the project file.
2. submit a project on the server
After modifying the file on the server, submit the modified Code and run "Git status" to check the modification Status of the project file.
The file has been modified, but the commit operation is not executed. Run the command 'git commit-a-m "comment information "'
-- Here, you can directly call the GIT commit command and enter a comment.
-- Enter the submit comment in the command line as follows: git commit-M "Initial commit of gittutor reposistory ". Note: The commit comments of git must not be empty; otherwise, the commit fails.
-- The-a parameter of git commit can be forcibly submitted without the changes identified by git add, but this method is not recommended.
You have submitted a project modified on the server. You can run git status to check the status of the version library and ensure that no files are submitted or tracked, you can run the "Git pull" command to obtain the code from the server repository and merge it with the local code. (If the project is changed by another person between clone and commit, execute this command to integrate the changes)
Run the "Git push" command to update the local commit code to the remote version library.

Local Project Operations
1. log on to the server through putty and clone the project to the local device from the server.
2. Switch the directory to the working directory in the local command line, that is, the folder directory where the project is to be cloned, and then run
Git clone XX @ xxx:/home/dev/repos/XX. Git

You can obtain the remote git repository (the remote git repository obtained through git clone only contains the current working branch of the remote git repository .)

3. After the project is updated, submit the local update to the server, enter the directory of the local project, and execute
Git status
Check the status to make sure that all files have been tracked and committed, and then execute
Git pull
Update the local code. Enter the server password prompt, enter it, and then execute
Git push
Prompt to enter the server password. After that, the local project will be submitted to the remote server.
At this point, the remote access to this project found that the project was not updated, and later I learned that the Code will be updated on the development server after the submission.
Go to the remote server and switch the current directory to the project directory.
CD workspace/project/


A workflow for git operations is over ~
Git command usage:
Git clone XX @ xxx:/home/dev/repos/XX. Git -- extract the code of the server repository to the local directory (interact with the server)
Git push XX @ ipaddr: Remote repository name local branch name remote branch name. -- This command pushes a local branch of the local git Library to the remote branch name of the remote git library.

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: 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.