Important GitHUB
Important GitHUB
Important GitHUB
git commit -m “[ Type in the commit message]” ->records or snapshots the file
permanently in the version history.
git commit -a ->commits any files you’ve changed since then.&commits any files
you’ve added
git diff ->shows the file differences which are not yet staged.
git diff –staged ->differences between the files in the staging area and the latest
version present.
git diff [first branch] [second branch] ->differences between the two branches
mentioned.
git reset [file] ->unstages the file, but it preserves the file contents.
git reset [commit] ->undoes all the commits after the specified commit and
preserves the changes locally.
git reset –hard [commit] ->discards all history and goes back to the specified
commit.
git rm [file] ->deletes the file from your working directory and stages the
deletion.
git log ->used to list the version history for the current branch.
git log –follow[file] ->lists version history for a file, including the renaming of
files also.
git show [commit] ->shows the metadata and content changes of the specified commit.
git branch ->lists all the local branches in the current repository.
git branch [branch name] -> creates a new branch.
git branch -d [branch name] -> deletes the feature branch.
git checkout [branch name] -> used to switch from one branch to another
git checkout -b [branch name] ->creates a new branch and also switches to it.
git checkout -d [name of the branch] -> to delete the branch
git merge [branch name] ->merges the specified branch’s history into the current
branch.
git remote add [variable name] [Remote Server Link] ->used to connect your local
repository to the remote server.
git remote rm [variable name] -> to delete remote
git push [variable name] master ->sends the committed changes of master branch to
your remote repository.
git push [variable name] [branch] ->sends the branch commits to your remote
repository.
git push –all [variable name] ->pushes all branches to your remote repository.
git push [variable name] :[branch name] ->deletes a branch on your remote
repository.
git pull [Repository Link] ->fetches and merges changes on the remote server to
your working directory.