<<<<<<< HEAD ======= >>>>>>> 8f924ec8939741408e44785587a73b4aff4b3f0f

git

pointers


basically

terminology

codeblocks


copy pasta commands

  • make present working directory a git repo.
    git init
    
  • configure
    git config --global user.name "name"
    git config --global user.email "mail"
    
  • stage file to commit.
    git add fname
    
  • delete a file and stage it's deletion.
    git rm fname
    
  • stage all changes.
    git add .
    
  • stage all files currently existing in location.
    git add *
    
  • commit the staged files with commit message.
    git commit -m msg
    
  • commit all changes in curr repo with msg.
     git commit -a -m "msg"
    
  • reset last n commits.
    git reset --soft HEAD~n
    
  • rename main branch.
      git branch -M localMain
    
  • track changes of a remote branch
    git ---set-upstream-to=localNameForRemoteRep/branchname localbranchename
    
  • list remotes assosiated, and describe them
    git remote -v
    
  • add a link to a repo on some remote server
     git remote add localNameForRemoteRep remoteRepoUrl
    
  • get changes made in given branch of remote repo and update local branch with them.
     git pull localNameForRemoteRep branchename
    
  • upload current repository data and status to clone on server
    git push localNameForRemoteRepbranchename
    
  • switch to another branch
    git checkout branchname
    
  • switch to new branch
    git checkout -b branchname
    
  • check changes, branch , etc.
    git status
    
  • show history upto last n commits/branches in Vim, exit by >q
    git log -n
    
<<<<<<< HEAD ======= >>>>>>> 8f924ec8939741408e44785587a73b4aff4b3f0f