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