37
loading...
This website collects cookies to deliver better user experience
Git is so powerful. There are a lot of really cool features. Some other basic functions you'll want to learn is how to git pull
, git clone
, git merge
, git rebase
, git stash
, git checkout
, and git branch
. Those are the ones that are needed for base level proficiency in git.
empty git repo
in specified directory. Run with no argumentsgit init
cloning
the repo onto your local machinegit clone <repo--HTTP or SSH>
author name
to be used for all commits in current repogit config user.name <name>
stage
all changes in <directory>
or <file>
for the next commitgit add <directory or file>
git add .
List
which files are staged, unstaged, and untrackedgit status
commit
the staged snapshot with a commit messagegit commit -m "<message>"
git log
git diff
git branch
git checkout -b <branch>
-b
flag is for checking out an existing branchgit merge <branch>
remote repo
.git remote add <name> <url>
<name>
as a shortcut for <url>
in other commands.<branch>
to fetch all remote refsgit fetch <remote> <branch>
git pull <remote>
Push
the branch to , along with necessary commit objects. Creates named branch in the remote repo if it doesn't existgit push <remote> <branch>
<base>
.Launches editor to enter commands for how each commit will be transferred to the new basegit rebase -i <base>
git pull --rebase <remote>
git push -u <remote> <branch>
--force
or -f
flag unless you're absolutely sure you know what you're doinggit push <remote> --force
git push -f <remote> <branch>
git revert <commitId>
git revert Head
to create a new commit with the reverted changes which had been done in the last commit.git reset <file>
-n
flag is used for double checking before changing, to execute use -f
in place of -n
git clean -n
git commit --amend
<base>
can be a commit ID, branch name, a tag, or a relative reference to HEAD.git rebase <base>
--relative-date
flag to show date time info or --all
to show all refs.git reflog