Catalog
  1. 1. Git
    1. 1.1. Simple use
      1. 1.1.1. 1. Create new repository
      2. 1.1.2. 2. Update changes each time
      3. 1.1.3. 3. how do I fork an older version of a github project?
Useful Git Command

Git

Simple use

In this note I will summarize the simple use of Git. How can we create new repository and upload the local folders to remote? Or after we changes or add new files, how can we update the changes?

1. Create new repository

We should create new repository in the remote. Then we clone the remote repository into local folder. We can make changes on the folder and update the changes via

1
2
3
git add .
git commmit -m "changes"
git push -u origin master

”-u“ is for the first update.

2. Update changes each time

If the repository has been create in the remote and the local folder has push history. You can fetch changes from remote repository.

1
git pull

add new files to remote repository

1
2
3
git add .
git commmit -m "changes"
git push origin master

More details will be added if needed.

3. how do I fork an older version of a github project?

from
how do I fork an older version of a github project?

  1. Fork the repo.
  2. Clone it locally: git clone <github name>
  3. Find the commit you want to go back to.
  4. Reset to that commit’s SHA: git reset <SHA>
  5. Get rid of changes: git add . && git stash
  6. Push removal of changes to repo: git push --force
Author: Knifelee
Link: https://knifelees3.github.io/2019/12/25/A_En_Git_CommandSummary/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Donate
  • 微信
  • 支付寶

Comment