Skip to content
Yulei Sui edited this page Oct 18, 2022 · 9 revisions

1. Set up your git names

git clone https://github.com/SVF-tools/SVF.git
git config --global user.name "Your name"
git config --global user.email "[email protected]"

2. Git status (any local new changes) and log (commit history of your local repo)

git status
git log

3. Git pull from your repo

git pull

4. Add your changes, commit and push to your repo

git add your_file
git commit -m "comments"
git push

5. Git reset to HEAD (remove a file from your commit file list)

git reset HEAD yourfile

6. Git pull from a remote repo

git remote add upstream https://github.com/SVF-tools/SVF.git
git pull upstream master
git push origin master   # push to your repo once after your pull from a remote repo

7. Git push to a remote repo

git remote add upstream https://github.com/SVF-tools/SVF.git
git push upstream master

8. Make a pull request from private repo to a public one

git clone https://github.com/SVF-tools/SVF.git
cd public-repo
git remote add private_repo_yourname https://github.com/yuleisui/SVF.git
git checkout -b pull_request_yourname
git pull private_repo_yourname master
git push origin pull_request_yourname

9. Git switch to an existing branch

git checkout [name_of_your_existing_branch]
git checkout origin/master

10. Create the branch on your local machine and switch in this branch

git checkout -b [name_of_your_new_branch]

Push the branch on github :

git push origin [name_of_your_new_branch]

11. Delete a Local Git branch (first, you need to switch to another branch to delete the one you want)

git branch -d branch_name

12. Delete a remote Git branch

git push origin --delete <branch_name>

13. Git Rebase to a certain commit

git rebase -i commitId

For example, there are two commits 154a03f6 and ac9c1fd4 after a commit e06b526 (git rebase -i e06b526). You will need to change the following two pick to be s, so that the two commits are merged to e06b526

pick e06b526 dyn lib 18.04 ubuntu
pick 154a03f6 update bc files
pick ac9c1fd4 Update build.sh
pick e06b526 dyn lib 18.04 ubuntu
s 154a03f6 update bc files
s ac9c1fd4 Update build.sh

Finally, you will need to force git push

git push -f
Clone this wiki locally