Install and use git

Source: Internet
Author: User

Install and use git
Install Git

  • Download and install mysysgit
  • Download and install git for windows and configure Git
    • Set your name and email address
      Git config -- global user. name "xxxx"
      Git config -- global user. email [email protected]

      Note: These configurations will appear in the git commit log as the Author identifier

      • For more configurations, runGit config -- helpObtain the generated RSA Key
        • Open git-shell and executeSsh-keygen-t rsaAnd press Enter when prompted.
        • Set C:/Documents and Settings/ /. Ssh/id_rsa.pub.
        • Copy the content in id_rsa.pub and paste it to the Add SSH key interface in github account management. Create a local project
          • Download Code from remote Repository
            • Java project: git clone [email protected]: tpc-arch/sohu-mobile.git local working folder
              • Cd local working folder after download is complete
                • After the local project is created, import the project to IEDA (IEDA10.0 is recommended and Git plug-in is provided) to create the branch process.
                  1. Git branch This command only creates a branch locally.
                  2. Submit the local branch to the remote BranchGit push origin Code merging process
                    1. Switch to master git checkout master
                    2. Pull the latest master code git pull origin master
                    3. Git merge
                    4. The merge operation can submit the local master to the remote master git push origin master

                      All the preceding operations can be completed in IDEA. We recommend that you use the IDEA tool to perform the merge operation. In case of conflicts, You can visually handle conflicts.

                      Tag tagging process
                      1. Git tag tag_name create tag
                      2. Git push -- tags submit the tag to a remote repository. Common Git command line operations
                        • Create Branch
                          Git branch
                          • Update code remotely, only update, but not merge to local branch
                            Git fetch
                            • Update code remotely and merge it into the current Branch
                              Git pullOrigin develop
                              • Switch the branch of the working directory to the specified branch.
                                Git chekcout
                                • Add the file to the git index to submit the file.
                                  Git add.
                                  • Submit a file,The submission here is only submitted in the local repository.
                                    Git commit
                                    -A-m "comment"
                                    • Content pushed to the remote warehouse
                                      Git pushOrigin develop
                                      • Tag
                                        Git tag
                                        • Submit tag to remote Repository
                                          Git push -- tags
                                          • Merge the specified branch to the current Branch
                                            Git merge
                                            • To reproduce the branch ends.
                                              Git rebase
                                            • View help. git has built-in powerful help functions and Intelligent Input correction, which can be viewed at any time.
                                              Git help
                                            • It is very useful to view the local repository status. We recommend that you use this command First *
                                              Git status
                                            • Compare the differences between tag and HEAD

                                              Git diff tag

                                              • Compare the differences between two files

                                                Git diff tag file

                                                • Compare the differences between two tags

                                                  Git diff tag1.. tag2

                                                  • Compare the differences between two tags of a file

                                                    Git diff tag1: file tag2: file

                                                     

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.