Skip to content

Shrilboss/mygit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mygit (simple git implementation)

This is our implementation of git using C and C++. We have implemented the following commands (flags not included):-

  • init
  • add
  • commit
  • branch
  • checkout
  • merge
  • log
  • reflog
  • stash
  • reset
  • included support for ".gitignore" file

Git objects

Everything in git is stored in form of objects. There are mainly 3 types of objects:-

  • blob
  • tree
  • commit

Git objects

mygit init

Initialise a new git repository mygit init

mygit add <dir/file>

Add files to staging area. mygit add

Index file

File to represent the staging area Index file

mygit commit -m "commit message"

Commit the changes in staging area. A new commit object and tree structure is created accordingly. mygit commit

mygit branch <branch_name>

Create a new branch, if not specified print all branches mygit branch

mygit checkout <branch_name>

Checkout to the branch_name mygit checkout

mygit stash -m "stash message"

Stash the contents of staging area if we do not want to commit stash stash stash pop stash pop

mygit merge <branch_name>

Merge the contents of current branch with the branch specified Fast Forward Merge fast forward merge Three Way Merge Three way merge

mygit log

Gives the information about all the commits done by the user of current branch. log

mygit reflog

Gives information about merges, checkouts, commits done by user till that point. reflog

Setup

Clone the project --

git clone https://github.com/UrvishkumarPatel/mygit.git

Install mygit

 make

Usage

  • mygit init :-Initialises a new git reposistory.
  • mygit add <dir/file>:-Adds the file in the stagging area(Index file).
  • mygit commit -m "commit message":-Commits the added file with the message given.
  • mygit branch <branch_name>:- Creates a new branch with branch name.
  • mygit checkout <branch_name>:- Checkouts to the branch specified.
  • mygit merge <branch_name>:- Merges current branch with specified branch.
  • mygit log <branch_name>:- Gives the information about all the commits done by the user of current branch.
  • mygit reflog <branch_name>:-Gives information about merges, checkouts, commits done by user till that point.
  • mygit stash -m "commit message":- Stash the contents of the staging area, commit is not required after that.

Note

Files specified in .gitignore are ignored while adding and commiting.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages