{"id":27159147,"url":"https://github.com/nageshjagtap/git-and-github-task","last_synced_at":"2026-05-05T06:39:57.177Z","repository":{"id":263365417,"uuid":"889336411","full_name":"NAGESHJAGTAP/git-and-github-Task","owner":"NAGESHJAGTAP","description":"\"A comprehensive guide on advanced Git operations, covering stashing, rewriting history, cherry-picking, tagging, remote repository management, and contributing to open-source projects. Perfect for developers looking to master Git workflows efficiently.\"","archived":false,"fork":false,"pushed_at":"2025-03-30T22:14:20.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T23:20:40.140Z","etag":null,"topics":["git","github"],"latest_commit_sha":null,"homepage":"","language":null,"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/NAGESHJAGTAP.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":"2024-11-16T05:26:54.000Z","updated_at":"2025-03-30T23:13:20.000Z","dependencies_parsed_at":"2025-03-30T23:32:25.671Z","dependency_job_id":null,"html_url":"https://github.com/NAGESHJAGTAP/git-and-github-Task","commit_stats":null,"previous_names":["nageshjagtap/git-task","nageshjagtap/git-and-github-task"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NAGESHJAGTAP%2Fgit-and-github-Task","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NAGESHJAGTAP%2Fgit-and-github-Task/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NAGESHJAGTAP%2Fgit-and-github-Task/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NAGESHJAGTAP%2Fgit-and-github-Task/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NAGESHJAGTAP","download_url":"https://codeload.github.com/NAGESHJAGTAP/git-and-github-Task/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247941702,"owners_count":21022037,"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":["git","github"],"created_at":"2025-04-08T22:49:50.833Z","updated_at":"2026-05-05T06:39:52.155Z","avatar_url":"https://github.com/NAGESHJAGTAP.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advanced Git Operations\n\nThis document provides an in-depth guide to advanced Git operations, including stashing changes, rewriting history, cherry-picking commits, tagging versions, working with remote repositories, and contributing to open-source projects. This guide is aimed at developers looking to enhance their Git workflow for better efficiency and collaboration.\n\n---\n\n# 📌 Part 1: Understanding and Using `git stash`\n\n## ✅ Task 1: Save Changes Temporarily with `git stash`\n\n### 1️⃣ Modify a file without committing changes:\n```sh\necho \"Temporary changes\" \u003e\u003e temp-file.txt\n```\n* Adds temporary content to a file.\n\n### 2️⃣ View the status of changes:\n```sh\ngit status\n```\n* Displays the status of unstaged changes.\n\n### 3️⃣ Stash the changes:\n```sh\ngit stash\n```\n* Saves changes to a stash and resets the working directory to the last commit.\n\n### 4️⃣ View the stashed changes:\n```sh\ngit stash list\n```\n* Shows a list of stashed changes.\n\n## ✅ Task 2: Apply and Drop Stashed Changes\n\n### 1️⃣ Apply the most recent stash:\n```sh\ngit stash apply\n```\n* Applies the most recent stash without removing it from the stash list.\n\n### 2️⃣ Drop the most recent stash after applying it:\n```sh\ngit stash drop\n```\n* Deletes the most recent stash entry.\n\n### 3️⃣ Apply a specific stash:\n```sh\ngit stash apply stash@{1}\n```\n* Applies a specific stash by its identifier.\n\n## ✅ Task 3: Stash Untracked Files\n\n### 1️⃣ Stash changes, including untracked files:\n```sh\ngit stash -u\n```\n* Stashes both tracked and untracked files.\n\n### 2️⃣ Apply stashed changes including untracked files:\n```sh\ngit stash apply\n```\n* Applies the stashed changes, including untracked files.\n\n---\n\n# 📌 Part 2: Rewriting History with `git rebase`\n\n## ✅ Task 4: Rebase Commits to a New Base\n\n### 1️⃣ Rebase the current branch onto `main`:\n```sh\ngit rebase main\n```\n* Moves the commits of the current branch on top of the `main` branch.\n\n### 2️⃣ Resolve conflicts and continue:\n```sh\ngit rebase --continue\n```\n* Resolves conflicts and proceeds with the rebase process.\n\n## ✅ Task 5: Cancel a Rebase\n\n### 1️⃣ Abort the rebase if needed:\n```sh\ngit rebase --abort\n```\n* Cancels the rebase and restores the branch to its original state.\n\n---\n\n# 📌 Part 3: Interactive Rebase (`git rebase -i`)\n\n## ✅ Task 6: Modify Commit History with Interactive Rebase\n\n### 1️⃣ View the last few commits:\n```sh\ngit log --oneline\n```\n* Displays a compact commit history.\n\n### 2️⃣ Start an interactive rebase for the last 3 commits:\n```sh\ngit rebase -i HEAD~3\n```\n* Opens an interactive rebase session for the last 3 commits.\n\nModify commits by changing `pick` to:\n- `squash` (combine commits)\n- `reword` (edit commit message)\n- `edit` (modify commit content)\n- `drop` (remove commit)\n\n## ✅ Task 7: Complete Interactive Rebase\n\n### 1️⃣ Save and close the editor after making changes.\n### 2️⃣ Resolve conflicts and continue:\n```sh\ngit rebase --continue\n```\n* Completes the rebase after conflict resolution.\n\n---\n\n# 📌 Part 4: Cherry-Picking Commits\n\n## ✅ Task 8: Apply a Specific Commit from Another Branch\n\n### 1️⃣ Find the commit hash to cherry-pick:\n```sh\ngit log --oneline\n```\n* Displays commit hashes and messages.\n\n### 2️⃣ Cherry-pick a specific commit:\n```sh\ngit cherry-pick \u003ccommit-hash\u003e\n```\n* Applies the specified commit to the current branch.\n\n### 3️⃣ Resolve conflicts if needed:\n```sh\ngit cherry-pick --continue\n```\n* Completes cherry-picking after conflict resolution.\n\n---\n\n# 📌 Part 5: Tagging Commits\n\n## ✅ Task 9: Tag a Commit\n\n### 1️⃣ Tag the current commit with a version number:\n```sh\ngit tag -a v1.0 -m \"Initial release\"\n```\n* Creates an annotated tag with a message.\n\n### 2️⃣ List all tags:\n```sh\ngit tag\n```\n* Displays all available tags.\n\n## ✅ Task 10: Push Tags to Remote\n\n### 1️⃣ Push a specific tag:\n```sh\ngit push origin v1.0\n```\n* Pushes the specified tag to the remote repository.\n\n### 2️⃣ Push all tags:\n```sh\ngit push --tags\n```\n* Pushes all tags to the remote repository.\n\n---\n\n# 📌 Part 6: Working with Remote Repositories\n\n## ✅ Task 11: Add a Remote Repository\n```sh\ngit remote add origin https://github.com/username/repo.git\n```\n* Links a remote repository named `origin`.\n\n## ✅ Task 12: Fetch Changes from Remote\n```sh\ngit fetch origin\n```\n* Retrieves updates from the remote repository without merging.\n\n## ✅ Task 13: Pull Changes from Remote\n```sh\ngit pull origin main\n```\n* Fetches and merges changes from the remote `main` branch.\n\n## ✅ Task 14: Push Changes to Remote\n```sh\ngit push origin main\n```\n* Pushes local commits to the remote `main` branch.\n\n---\n\n# 📌 Part 7: Forking and Contributing to Open-Source Projects\n\n## ✅ Task 15: Fork a Repository on GitHub\n- Use the GitHub UI to fork a repository.\n- Clone the forked repository:\n```sh\ngit clone https://github.com/your-username/repo.git\n```\n\n## ✅ Task 16: Create a Pull Request\n- Submit a pull request (PR) via GitHub after pushing your changes.\n\n## ✅ Task 17: Sync Your Fork with the Original Repository\n```sh\ngit remote add upstream https://github.com/original-owner/repo.git\n```\n* Links the original repository as `upstream`.\n\n```sh\ngit fetch upstream\n```\n* Fetches updates from the upstream repository.\n\n```sh\ngit merge upstream/main\n```\n* Merges updates into your local branch.\n\n```sh\ngit push origin main\n```\n* Pushes the updates to your forked repository.\n\n---\n\n# 📌 GitHub Repository\n[🔗 Visit GitHub Repository](https://github.com/your-username/repo)\n\n---\n\n# 📌 Summary\n- **Stashing:** Temporarily save and apply uncommitted changes.\n- **Rewriting History:** Modify commit history using `git rebase`.\n- **Cherry-Picking:** Apply specific commits from another branch.\n- **Tagging:** Label commits for versioning.\n- **Remote Repositories:** Manage remotes, pushing, pulling, and fetching changes.\n- **Forking \u0026 Contributing:** Collaborate effectively in open-source projects.\n\n🎯 **Master these Git techniques to boost your development workflow!** 🚀\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnageshjagtap%2Fgit-and-github-task","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnageshjagtap%2Fgit-and-github-task","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnageshjagtap%2Fgit-and-github-task/lists"}