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 | git add . |
”-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 | git add . |
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?
- Fork the repo.
- Clone it locally:
git clone <github name>
- Find the commit you want to go back to.
- Reset to that commit’s SHA:
git reset <SHA>
- Get rid of changes:
git add . && git stash
- Push removal of changes to repo:
git push --force
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment