Upload your local project to GitHub

  1. CD Go to the local project folder
  2. Initialize the Git project repository with Git init
  3. Add all files to the staging area
git add .
Copy the code
  1. View the status of the local warehouse
git status
Copy the code
  1. Submit code
git commit -m "comment"
Copy the code
  1. Connect to remote GitHub and create the repository
  2. Associate a local repository with a remote repository
git remote add origin [email protected]:ChHerman/learngit.git
Copy the code
  1. Merge remote repository with local repository code
git pull --rebase origin master
Copy the code
  1. Commit to local warehouse
git push -u origin master
Copy the code

Git Git

Git config –global user. Name” Your name “git config –global user. Email “[email protected] Git commit -m

Add a file to the repository git status display the status of the repository git diff check your changes git reset –hard Git reset –hard HEAD^ go back to the previous version, Git reflog — file git checkout — file git reset HEAD

Git remote add origin git@server-name:path/repo-name. Git associate the remote repository git push -u origin master Git branch

Create a branch git Git checkout -b

or git switch -c

Git merge –no-ff -m “merge with no-ff”

Git branch -d

delete branch Go back to work git cherry-pick

copy the bug content to the current branch git remote -v check the remote library information git push origin Git checkout -b branch-name origin/branch-name Associate the local branch with the remote branch git rebase Git tag

create a new tag git tag -a

-m “comment” create a new tag git tag -d

Delete tags git push origin

push local tags git push origin -tags push all unpushed local tags git git push origin :refs/tags/

Deletes remote tags












Git

How to use GitHub effectively

A concise guide to GitHub

The illustration Git