Git basics
-
Upload
denys-haryachyy -
Category
Software
-
view
267 -
download
0
Transcript of Git basics
GITBasic commands
Change username, e-mailGloballygit config --global user.namegit config --global user.emailFor a repogit config user.namegit config user.email
Change remote originCheck all branches and its trackinggit show remote origin
Change branch trackinggit branch branch_name -u <your_new_remote/branch_name>
Clone and pullRebase rolling commits abovegit pull --rebaseRefreshgit fetch -p
Clean and reset branchesDelete untracked files and folders
git clean -fdMake a local branch identical to a remote one
git reset --hard origin/<branch_name>
Diff and mergeDiffgit diff <commit_id>git difftool <commit_id>Mergegit merge <branch_name>git mergetool <branch_name>
Delete branchesTo remove a local branch from your machine:git branch -d the_local_branchgit branch -D the_local_branchTo remove a remote branch from the server:git push origin :the_remote_branchgit push origin --delete the_remote_branch
Adding external repositoriesgit submodule add <repo.git> <local folder>git submodule initgit submodule update
Configure remote branch trackinggit branch -u upstream/foo
PatchesGenerate a patch from the last commitgit format-patch -1 HEADApply a patchpatch -p1 < file.patch
Coloursgit config --global color.ui auto