knnan
1/2/2019 - 10:34 AM

Git commands

Git commands

#git init :- Initialised the current directory with a git repo

  1. git add -A :- stages all files git status :- shows the status of ur repo git commit -m "message" :- commit the stages files using the given message
    git branch {branch name} :- create a new branch git checkout {branch name} :- to move to another branch git branch :- shows all local branches
    git branch -a :- shows all the branches
    gid branch -d {branch name} :- delete a branch
    git merge {from which branch} :- merges the file in branch(given name) with the current branch git log :- show the log of all commits git remote add origin {Url of the github repo} :- Add a remote to the local git repo git remote add {give any name u want} {Url of the github repo} :- Add a remote to the local git repo git remove -v :- verify remote git pull -u origin master :- pull the current files from origin git push -u origin master :- pushl the current files from origin git clone {url} {destination} :- clones the files to the specified destination from the url (git clone https://github/nashpb/Work_launcher . ) git config list -- :- lists all the configuration of the git(can see git.user and git.email) git reset --hard HEAD~{no of commits u want to remove} :- remove all traces of the commit specified git reset HEAD~{no of commits u want to remove} :- remove the commit but keeps the changes so u could make changes and then add the new commit