Git Commands

to clone a repository:

git clone my_git_address


list local branches:

git branch

list remote branches:

git branch --remote

Checkout and track a remote branch:

git checkout --track origin/xyz

Push a local branch to a new remote branch name

git push --set-upstream origin <remotebranchname>


Sometimes you want to see what has changed. git status can be used to see which files have changed since the last commit. Otherwise, you can use git diff to more closely inspect file changes line by line


Push a quick commit:

If you created a local branch and need to link it to a remote:

git push --set-upstream origin <localbranchname>
git add *
git commit -m "commit message"
git push

or combined:

git add * && git commit -m "update" && git push


from here

to pull submodules

git submodule update --init --recursive
git submodule update --recursive --remote

cd into the proper subdirectory ensure you are attached to a branch:

git branch

if not check one out

git checkout [branchname]


git clean -dxf

feetch all remote tags

git fetch --all --tags

check out tag to a new branch

git checkout tags/<tag> -b <branch>


git checkout tags/Ubuntu-5.13.0-21.21 -b Ubuntu-5.13.0-21.21

External references