some advance git commands - tingxingdong/clBLAS-private GitHub Wiki

//create a new branch
git checkout -b new_branch
//switch to a existing branch
git checkout existing_branch

The remote branch is automatically created when you push it to the remote server. So when you feel ready for it, you can just do:

git push

//keep password
git config β€”global credential.helper store

//save existing files not commit yet
git stash save a (means all)
//see log
git log
//pop back files you save in last command
git stash pop
-
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-
error: pathspec ’commit’’ did not match any file(s) known to git.

solution: you may carelessly add an git init just, delete it by β€œrm -rf .git”

If you change your remote project name
see this
https://blog.cloudtroopers.com/rename-github-repository-without-fear

============
If I want to combine last 4 commits, but I have already push to my cloud_repo , I can do this in my terminal/

On a branch I was able to do it like this (for the last 4 commits)

git reset β€”soft HEAD~4
git commit
git push β€”force my_cloud_repo my_local_branch

============
How to merge with a remote named upstream
1) git pull upstream
2) git merge upstream/develop
3) it will probably shows you some conflicts.to solve them
e.g.
git checkout -ours -

  1. or
    git checkout -theirs -
    4) finally git commit
⚠️ **GitHub.com Fallback** ⚠️