Skip to content

alexandraavendano/PracticeGit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

GIT

GIT LOG:

  • I want to check the difference of each file (-p) for the last 2 commits (-2).

    $ git log -p -2

  • I want to check an specific file and how many lines where updated in each commit.

    $ git log --stat

  • I want a pretty way to see commits

    $ git log --pretty=format:"%h - %an, %ar : %s" `

  • I want to see the commits with the branches structure.

    $ git log --graph

  • I want to check the commits that were made the last 2 weeks avoiding merges commits.

    $ git log --since=2.weeks --no-merges

GIT AMMEND:

  • Ops, I forgot to add a file and/or I want to change a typo. If you have your changes LOCALLY ->

    $ git commit -m 'Initial commit' $ git add forgotten_file $ git commit --amend

  • Ops, I add a file that I don't want in the commit

    $ git reset HEAD <file.name> or $ git restore --staged <file.name>

  • Ops, I don't want to commit neither stash the changes that I made in . Unrecoverable!

    $ git checkout -- <file.name> or $ git restore <file.name>

GIT REMOTES:

  • I want to clone a remote repository.

    $ git clone

  • I create a new repo in my local and I want to link it with a new repo in github.

    $ git init $ git remote add <url.git> $ git add . $ git commit -m 'Initial commit' $ git push

  • I want to have my own repo based on another repo just in case I messed up. ** Check this out! Note: First create a forke of an existing repo in github this would give you a url.git

    $ git remote add <url.git> $ git fetch $ git checkout /<branch_name>

  • I want to check what it is in a repo that I forked

    $ git remote show

  • I want to check witch remotes do I have

    $ git remote -v

  • I want to push commits that I have in the remote

    $ git push <branch_name>

  • Ops, I missspeled the name of my remote

    $ git remote rename

GIT TAGS :

Collaborators : Alexandra Avendano

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published