Linux --- common git commands and get and upload code on githubThis article is an entry to git and a personal study note. The level of understanding involved will not be too high, but it will also include the relevant commands we use everyday as much as possible. 1: Environment Description: System: Centos 7
First, prefaceIt is a wise choice to place GitHub as a hosting site for your project. Even if you don't think about your project, you have to learn to develop your team project. Maybe some beginners (like me) will feel git command a lot of Ah, is a variety of terminology, feel very difficult to get started. Actually learning some of the basics of GIT commands is
Create a new project (manager)
Login to the GIT server and enter/data/git/repositories
Create directory Algorithm.git, and enter the directory
Executing git init--bare
Enter/data/git/repositories/gitosis-admin.git
Edit gitosis.conf and add the following:[Group algorithm]writable = alg
Git overwrites local modifications, git discards local modifications, and force updates
Git fetch -- allgit reset -- hard origin/Master
Git fetch only downloads the content of the remote library, and does not merge git reset to direct the head to the latest version just do
After the automatic change to the new department, every nine o'clock in the evening to 10 hours of normal work, and not much time to do the finishing. Although there are many things, less free time, but this is not a pretext to summarize. Don't say much nonsense, start with a simple one! About the git command principle related to the introduction of a large number of online, here just to organize their usual work in the most of the
Recently, some of my small projects to GitHub, using Git is no longer just simple add, push, etc., as a novice, encountered a lot of problems, today there is time to organize and record, and continue to update.Uploading to a remote repositorygit init //初始化,建立本地仓库git add ***** //向本地库添加文件git commit -m ‘*****‘ //添加注释,这是一个好习惯,我通常会加上时间
git clone https://github.com/JasonCheung2012/learngit.git #版本库网址
git add zhangjiethu.txt
Git commit-m "Add a File"
Git push-u Origin Master # submits your local repository to your GitHub account and asks you to enter your GitHub account number and password
Status of Git
Tags: include log terminal command switch dir terminal content detailed addVersion Control tool: GitLinux/macos Terminal commandsNote: the command parameter directoryAll commands are in the English stateParameters can be mixed using eg:-la-al1.CD: Switch Files directory~ Home Directory/root directory: Top-level Directory desktop Desktops2.ls: Query-A: All files, including hidden files-Up: More information3.touch: Create file Mode: file name. type4.ope
1. Create a git repository???? Git init--bare library name????2. Clone the resource under the user folder???? git clone ???? Note: The user directory must be empty when clone?3. Create a file that is included in version control.???? git add ???? The first execution would warn: WARNING:LF will is replaced by CRLF in Rea
git clone [email protected]:server/bilinserver.git target path----------------server pull a git repository to local
Git branch--------------------------------------------------------------------see where all the branches on the local branch are currently in
git branch-a------------------------------------------
1, download the installation methodHttp://jingyan.baidu.com/article/020278117cbe921bcc9ce51c.html2, common commandsOriginal address: http://www.admin10000.com/document/5374.htmlThe basic common commands for Git are:Git pull--rebase Origin masterGit pull Origin MasterMKDIR:XX (Create an empty directory XX refers to the directory name)PWD: Displays the path to the current directory.Git init turns the current
Related directives:1. Create a new branch from the remote Master Branch, at which point the new branch content is the same as the master branch:git checkout master;Git branch newbranch;git checkout newbranch;Git commit-a-m ' New branch ';Git push Origin newbranch;2. Submit a new file a.txt to the local repository:git a
Common git commands
1. Basic commandsGit branch view local branchesGit branch-r view remote branchGit checkout xxx switch BranchGit pull origin master // synchronize from remote to local, master or branch nameGit pull origin xxxGit checkout-B xxx: Create a branch of xxxGit checkout-B local branch name remote branch nameGit branch-D xxx Delete local branchGit status view statusGit add file add to local serve
Like I'm using Git clone giturl under Windows.Just prompt for SSL certificate problem:self signed CertificateThis problem occurs more frequently in Windows. I guess the main thing is that git itself is Linux-based, and on Windows, it's easy to miss some environments.Referring to some articles, the solution is "directly regardless of SSL certificate"-_-| | |Here's how:1. Create a temporary environment variab
ssh-t [email protected]//test connectiongit config--global user.name "Youname"git config--global user.email "you email address"Git init//Turn this directory into a repository that git can managegit add readme.md//file added to Repository git Add. Not only can be with a single file, but also with wildcards, you can foll
If the label is wrong, it can also be deleted:$ git tag-d v0.1Deleted tag ' v0.1 ' (was d96a49b)If you want to push a tag to the remote, use git push orign tagname;$ GIT push origin v0.2Username for ' https://github.com ': [email protected]Password for ' https://[email protected] @github. com ':Counting objects:1, done.Writing objects:100% (1/1), 805 bytes | 0 by
git commandsgit statusgit add filenameGit commit-m ' Zhushi 'The address of GIT remote origin repositoryAddress of the Git clone repositoryGIT branch--set-upstream-to= remote repository name/branch name local branch name #关联分支Git pull Merge branch is required before #git pus
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.