Code Monkey home page Code Monkey logo

cs61b-sp21's Introduction

Acknowledgement

Course taught: CS61B spring 2021 Data structures

Projects/labs/notes

Link: https://sp21.datastructur.es/

Instructor: Josh Hug (the best)

Gitlet

Project2 Gilet is a git-like version control system features all local git key functions.

I put a lot of effort in it and learned a lot through the process so I am kinda pround of it.

Algorithms

Each file in your working directory can be in one of two states: tracked or untracked.

  • Tracked files -- that Gitlet knows about it.

    • Files has been added and staged.
    • File is modified if:
      • present in working directory, contents different than in head commit, and not staged.
      • present in working directory, has been staged, but file contents in stage area is different than in working directory. (dirty state)
      • absent in working directory, but in stage added.
      • absent in working directory, present in head commit, but not in stage removed.
  • Untracked files

    • Files in current working area, but not in last commit(head) and hasen't yet been staged.
  • Objects

    • Stage: represent a staging area, contains HashMap<String filename, String blobId> added ; HashSet<String filename> removed
    • Commit: represent a commit object, contains commitId, it's parents, tracked files, timeStamp, and commit message. |(SHA1)
    • Blob: represent a blob object contains blobId |(SHA1(filename,contents)), filename(join(CWD,filename)), byte [] content
  • Merge

cs61b-141

How to run

Compile with

  gitlet/*.java

Everything is set! run

  java gitlet.Main [command]

Gitlet features keyfunctions of local Git (make sure init before use other command)

   init
   add [file name] 
   commit [message]
   rm [file name]
   log
   global-log
   status
   find [commit message]
   branch [branch name]
   rm-branch [branch name]
   checkout -- [filename]
   checkout [commit id] -- [file name]
   checkout [branch name]
   reset [commit id]
   merge [branch name]

Persistence

.gitlet
    -- blobs
    -- commits
	-- staging
	-- [stage]
    -- refs
		-- heads -> [master][branch name]
	-- [HEAD]

blobs directory: stores all tracked(committed) file(name:blobId, content:blob.content)

commits directory: stores all commit objects

Staging: stores added file(filename, blobId), removed filename

stage: stage object

heads : stores branches, with branch name and a reference to commit

HEAD: a pointer reference current branch name if points at

cs61b-sp21's People

Contributors

sakana-xc avatar omarnabikhan avatar neil-kulkarni avatar zhu-eric avatar cclafferty5 avatar itaismith avatar borentsai avatar joshhug avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.