"Important" upload to GitHub using git command line

Source: Internet
Author: User
Tags diff tagname using git

"My GitHub Account:"
User name: Chenhongshuang
Password: shuangshuang6300
Email: [Email protected]

After entering the GitHub account

1 • Create a new project file name example demo, and click "Branch:master input gh-pages after enter":::

"The same project file name demo" must be built in any location of your computer after you have built it.

2 CD into a locally created project file: Git init

3 • Add files to the repository using the command git Add. Added to staging area inside, don't forget the decimal point ".", meaning to add all the files under the folder.
Execute: Git Add.


4 · Use the command git commit to tell git to submit the file to the repository. In quotation marks for submission instructions
Execute: Git commit-m ' first commit '


5 associated to the remote library, execute:

Git remote add origin your location (click on GitHub---Clone or download---automatically generated remote library address, copy it down)

6 · Get a remote library with a local synchronization merge (if the remote library is not empty, you must do this step, or the subsequent commit will fail):

Execution: Git pull--rebase Origin master

7 • Push the contents of the local library to the remote, using the git push command, and actually push the current branch master to the remote. After executing this command, you will be asked to enter a user name, password, and upload after verification.

Execution: Git push-u origin Master


8 · If you want the status query command:

Execution: Git status

9 · "Focus" if a local file has been modified to update to GitHub via the git command line, perform the following three steps "" to perform:::

"1 ·" Git Add.
"2 ·" Git commit-a-M "Project description cannot be empty here"
"3 ·" Git push Origin Master


【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】
"Git command-line commands supplement:::"

8. Git diff (view different)

9. Git log [--pretty=oneline {abbreviated version, Optional}] (view history)

git reset--hard head^ (fallback to previous version, HEAD can be commit_id)

Git Reflog (used to record your every command, find commit_id back to a future version)

git diff HEAD-<file> (see the difference between the latest version of the workspace and the repository)

Git checkout-<file> (replace the workspace version with the version in the repository, regardless of whether the workspace is modified or deleted)

git reset HEAD <file> (staging area undo (Unstage), re-put back to the workspace. When using HEAD, the latest version is indicated)

. Git rm (for deleting a file)

Ssh-keygen-t rsa-c "[Email protected]" (Create SSH Key)

*. git remote add origin [email protected]:bruce333/other.git (associated with GitHub ranged library)

Git push-u origin Master/git push Origin master
(push to remote library, the first time with the-u command, push all the contents of the Master branch, and then push the latest changes with the following command)

git clone [email protected]:bruce333/other.git (Clone a local library)

. git checkout-b Dev
(Create a dev branch and switch to the Dev branch, equivalent to the following two commands: Git branch dev[create branch]/git checkout dev[Switch branch])

. Git branch (list all branches with a * number in front of the current branch)

git checkout master (switch to master branch)

. Git merge Dev (merge specified branch to current branch)

git branch-d dev (remove dev Branch)

git log--graph (view branch merge diagram)

. Git merge--no-ff-m "merge with No-ff" Dev
(Typically, when you merge a branch, Git uses fast forward mode if possible, but in this mode, the branch information is discarded when the branch is deleted,--no-ff means that fast forward is disabled, merged with normal mode, the merged history has branches, and can be seen to have been merged;- M parameter, write the commit description in)

Git stash ("store" the current job site, and then continue working after resuming the site)

Stash git list (view work site)/git stash apply [email protected]{0} ()

Git stash POPs (restores the stash content as well: git stash apply[restore]/git stash drop[Delete])

branch-d git <name> (forcibly deleting a branch that has not been merged)

. Git remote (view remote library information)/git remote-v (show more details)

Git checkout-b branch-name origin/branch-name (the branch that is created locally and the remote branch, the name of the local and remote branch is best consistent)

33. Push the branch from the local, use GIT push Origin branch-name, if push fails, first crawl the remote new commit with Git pull

The. Git pull
(Capture the latest submissions; If you are prompted "No tracking information", the link relationship between the local branch and the remote branch is not created,
Using the command git branch--set-upstream branch-name origin/branch-name)

git tag <name> <commit ID is no >
(Hit a new tab, the default tag is on the latest committed commit, find the commit ID of the history commit, you can tag the history version)

Git show <tagname> (view tag information)

Panax Notoginseng git tag (view all tags)

$. Git tag-a <tagname>-M "Blablabla ..." (Specify label information)

Tag-s git <tagname>-M "Blablabla ..." (with PGP signature tag)

Max. Git tag-d <name> (delete tags)

$. Git push origin <tagname> (push a tag to remote)

A. Git push Origin--tags (all-in-one push is not yet pushed to a remote local label)

tag-d git <tagname> (delete a local tag)

. Git push origin:refs/tags/<tagname> (delete a remote tag)

$. git config--global color.ui true (let git display different colors appropriately)

46. When you omit certain files, you need to write the. gitignore;.gitignore file itself in the repository, and you can release the. Gitignore version Management

. git config--global alias.st status
(Tell Git, the next St will be the status, configure the alias, plus--global is for the current user, if not, it only works for the current warehouse, the GIT configuration file for each warehouse is placed in the. git/config file, the alias is behind [alias], To delete an alias, simply delete the corresponding line, and the current user's Git profile is placed in a hidden file in the user's home directory. Gitconfig)

"Important" upload to GitHub using git command line

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.