{"id":22957375,"url":"https://github.com/biohacker0/basicgit","last_synced_at":"2025-04-02T01:41:50.089Z","repository":{"id":196509762,"uuid":"696050782","full_name":"biohacker0/basicGIT","owner":"biohacker0","description":"\"Custom Git-like tool in Python for simplified version control operations, including repository initialization, file staging, commits, branch management, and basic merging.\"","archived":false,"fork":false,"pushed_at":"2023-09-26T11:39:12.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T16:43:20.351Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/biohacker0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-25T01:20:22.000Z","updated_at":"2023-09-25T12:28:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0da7ec8-1e6f-475e-83cb-8d94e2f3a3f5","html_url":"https://github.com/biohacker0/basicGIT","commit_stats":null,"previous_names":["biohacker0/basicgit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohacker0%2FbasicGIT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohacker0%2FbasicGIT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohacker0%2FbasicGIT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohacker0%2FbasicGIT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biohacker0","download_url":"https://codeload.github.com/biohacker0/basicGIT/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246741187,"owners_count":20826063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T17:16:21.954Z","updated_at":"2025-04-02T01:41:49.860Z","avatar_url":"https://github.com/biohacker0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"A Custom Git-Like Tool(Simulator)\n\n## Project Description\nI Built a custom Git-like tool implemented in Python. This tool allows users to perform basic version control operations such as initializing a repository, adding files to the staging area, committing changes, viewing commit history, creating branches, switching between branches, and merging branches.\nIts not git \"git\" , more like a fancy file mover which simulates git like features, but its fun to play around , and its more like git that moves files physically.\n\n## How It Works Internally\n1. **Initialization (`init`):** Users can initialize a new repository using the `init` command. This creates the necessary directory structure, including `objects`, `refs`, `commits`, and the `HEAD` file.\n\n2. **Adding Files (`add`):** The `add` command allows users to add files to the staging area. A unique filename based on the file's content is generated, and a copy of the file is placed in the staging area.\n\n3. **Committing Changes (`commit`):** Users can commit changes with the `commit` command. A commit message is provided, and a new commit directory is created in the `commits` folder. Staged files are copied to this directory, and the staging area is cleared.\n\n4. **Viewing Commit History (`log`):** The `log` command displays the commit history by iterating through the commit directories in the `commits` folder and showing their commit messages.\n\n5. **Creating Branches (`branch`):** The `branch` command enables users to create new branches. A branch file is created under `refs/heads` with the branch name.\n\n6. **Switching Between Branches (`checkout`):** Users can switch to a different branch using the `checkout` command. The `HEAD` file is updated to reference the selected branch.\n\n\n\n## Instructions to Use\n1. Clone the repository to your local machine using `git clone` or by downloading the ZIP file.\n\n2. Navigate to the project directory using your terminal or command prompt.\n\nHere are instructions on how to run your Simple Git project using two different methods: Command Line Interface (CLI) and the interactive menu (print functions).\ncurrently in script the CLI code is commented out so to use that you remove it from commment state and comment the print functions and vice versa:\n\nMethod 1: Interactive Menu (Print Functions)\nPS C:\\Users\\biohacker0\\Desktop\\mygit\u003e python mygit.py\n\n# You will be prompted to enter the repository name\nEnter repository name: myrepo\n\n# The interactive menu will be displayed\nAvailable actions:\n1. Initialize repository (init)\n2. Add files to staging area (add)\n3. Commit changes (commit)\n4. View commit history (log)\n5. Create branch (branch)\n6. Switch to branch (checkout)\n7. Merge branches (merge)\nEnter the action: init\n\n# You will be informed that the repository is initialized\nInitialized empty repository in repos\\myrepo\n\n# The menu continues to be displayed for further actions\nAvailable actions:\n1. Initialize repository (init)\n2. Add files to staging area (add)\n3. Commit changes (commit)\n4. View commit history (log)\n5. Create branch (branch)\n6. Switch to branch (checkout)\n7. Merge branches (merge)\nEnter the action: add\n\n# You will be prompted to enter file paths separated by spaces\nEnter file paths (space-separated): file1.txt file2.txt\n\n# You will receive a message that the files are added to the staging area\nAdded 'file1.txt' to the staging area as 'repos\\myrepo\\staging_area\\\u003cfile_hash1\u003e'\nAdded 'file2.txt' to the staging area as 'repos\\myrepo\\staging_area\\\u003cfile_hash2\u003e'\n\n# The menu continues for further actions\nAvailable actions:\n1. Initialize repository (init)\n2. Add files to staging area (add)\n3. Commit changes (commit)\n4. View commit history (log)\n5. Create branch (branch)\n6. Switch to branch (checkout)\n7. Merge branches (merge)\nEnter the action: commit\n\n# You will be prompted to enter a commit message\nEnter commit message: First commit\n\n# You will receive a message that the commit is successful\nCommitted 1: First commit\n\n# The menu continues for further actions\nAvailable actions:\n1. Initialize repository (init)\n2. Add files to staging area (add)\n3. Commit changes (commit)\n4. View commit history (log)\n5. Create branch (branch)\n6. Switch to branch (checkout)\n7. Merge branches (merge)\nEnter the action: log\n\n# You will see the commit history\nCommit history:\nCommit 1: First commit\n\n# The menu continues for further actions\nAvailable actions:\n1. Initialize repository (init)\n2. Add files to staging area (add)\n3. Commit changes (commit)\n4. View commit history (log)\n5. Create branch (branch)\n6. Switch to branch (checkout)\n7. Merge branches (merge)\nEnter the action: branch\n\n# You will be prompted to enter a branch name\nEnter branch name: feature-branch\n\n# You will receive a message that the branch is created\nCreated branch 'feature-branch'\n\n# The menu continues for further actions\nAvailable actions:\n1. Initialize repository (init)\n2. Add files to staging area (add)\n3. Commit changes (commit)\n4. View commit history (log)\n5. Create branch (branch)\n6. Switch to branch (checkout)\n7. Merge branches (merge)\nEnter the action: checkout\n\n# You will be prompted to enter a branch name to switch to\nEnter branch name: feature-branch\n\n# You will receive a message that you've switched to the new branch\nSwitched to branch 'feature-branch'\n\n# The menu continues for further actions\nAvailable actions:\n1. Initialize repository (init)\n2. Add files to staging area (add)\n3. Commit changes (commit)\n4. View commit history (log)\n5. Create branch (branch)\n6. Switch to branch (checkout)\n7. Merge branches (merge)\nEnter the action: merge\n\n# You will be prompted to enter the source and target branch names for merging\nEnter source branch: feature-branch\nEnter target branch: main\n\n# You will receive a message that the changes are merged\nMerged changes from 'feature-branch' into 'main'\n\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n##Method 2: Command Line Interface (CLI)\n\n   - Initialize a repository:\n     ```bash\n     python mygit.py init myrepo\n     ```\n\n   - Add files to the staging area:\n     ```bash\n     python mygit.py add myrepo file1.txt file2.txt\n     ```\n\n   - Commit changes:\n     ```bash\n     python mygit.py commit myrepo \"Initial commit\"\n     ```\n\n   - View commit history:\n     ```bash\n     python mygit.py log myrepo\n     ```\n\n   - Create a branch:\n     ```bash\n     python mygit.py branch myrepo feature-branch\n     ```\n\n   - Switch to a branch:\n     ```bash\n     python mygit.py checkout myrepo feature-branch\n     ```\n\n   - Merge branches (Note: This currently displays a message, but you can extend the code to perform actual merges):\n     ```bash\n     python mygit.py merge myrepo feature-branch main\n     ```\n\n     ```\n\nThis custom Git-like tool provides a simplified version control system with a command-line interface for basic version control operations. Feel free to extend and customize it according to your needs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiohacker0%2Fbasicgit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiohacker0%2Fbasicgit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiohacker0%2Fbasicgit/lists"}