- 💻 Installation
- 🧑💻 Setting up Git Environment
- 🔔 Git Commands List
- ⬆️ Upload a file or folder to Github
- 🤡 Clone a Git repository
- 👊 Push a file to remote repository
- 👨🔧Track or Unstage a file in local repository
- 🔀 Revert or Undo any commit
- 🌳 Git Branching
- 🥱 Git Pull - Fetch - Merge
- 🌚 Create a Pull Request
- 🕸️ Hosting a website using GitHub Pages
- 👑 How to write commit message like PRO
- ✌️ Git Commit Message Type
- 🥹 GitHub Related Problems and Solutions
- 🍕 How to make a Git Commit with a Past Date
- 🤷♀️ What is Git-Ignore and How To Use It !
- 🎀 How To Add Video, Audio and GIFs Files directly in README.md File
- 💁 Contribute to Open Source repository in GitHub
- 🍔 Fork and Clone Repository
- 🌭 Remote "Origin" and "UpStream"
- 🍿 Pull and Push change to upstream
- 🥗 Create new branch for contributing
- 🥪 Create a pull request
- 🥩 Tips for contributing in Open Source Project
- 🥶 Collaboration with Others
- 🌮 How to give access permissions of your repository to other
- 😷 Wrtting a Issue in the Project Repository
- 🤯 Resources for Finding an Open-Source Program Contribution
- 🎅 How to Resolving Merge Conflicts ?
- ⚔️ How To Edit Pushed Git Commit Message?
- 🫀 How to Roll Back ( Git Reset vs Revert ) a Git Repository to a Particular Commit
- 🤕 Ignore Files Using : .gitignore (How to use the gitignore file)
- 🦖 Tutorial : Documentation of GitHub Readme + Markdown Language
- 🫸 Push an existing Git repository to a different remote repository server?
- How to Create GitHub Account Step by Step (👉Tutorial Link)
- Git (👉Download)
- How to install Git Step by Step (👉Tutorial Link)
- GitHub Desktop (👉Download)
- How to install GitHub Desktop Step by Step (👉Tutorial Link)
🎥 Video Tutorial : (👉Click Here)
-
Open Git Bash
-
Write The Following Commands
- Set Name :
git config --global user.name "Gihub User Name"
- Set Email :
git config --global user.email "Github Email"
- Check status :
git config --list
- Set Name :
-
Setting Done Successfully
Command | Description |
---|---|
👉 git init | ✍️ Initialize a new repository |
git init |
|
👉 git clone | ✍️ Clone a remote repository |
git clone https://github.com/example/repo.git |
|
👉 git add | ✍️ Stage file changes |
git add file.txt |
|
git add . |
|
👉 git commit | ✍️ Commit changes with a descriptive message |
git commit -m "Added new feature |
|
👉 git status | ✍️ Check repository status |
git status |
|
👉 git push | ✍️ Push committed changes to a remote repository |
git push origin main |
|
👉 git pull | ✍️ Fetch and merge changes from a remote repository |
git pull origin main |
|
👉 git branch | ✍️ List of all branches |
git branch |
|
👉 git checkout | ✍️ Switch to a different branch |
git checkout new-feature |
|
👉 git merge | ✍️ Merge a branch into the current branch |
git merge new-feature |
|
👉 git log | ✍️ View git commit history |
git log |
|
👉 git remote | ✍️ Add remote repository |
git remote add upstream https://github.com/upstream/repo.git |
|
👉 git diff | ✍️ Show differences between files |
git diff file1.txt file2.txt |
|
👉 git reset | ✍️ Unstage a file |
git reset file.txt |
🎥 Video Tutorial : (👉Click Here)
✍️ Blog Guide Step by Step : (👉Click Here)
- First Create a repository in Github : (👉How To Create Repository : YouTube) (👉Blog Link)
- Select the folder that you want to upload
- Open Gitbash for that folder ( Right click on the folder and open git bash)
- Now write the following Code in Gitbash terminal
- Initialize it with git-specific functions :
git init
- Git isn't aware of these file, stage it :
git add .
- Take a snapshot of the staging area :
git commit -m "Commits Names"
- Select the master branch :
git branch -M main
- Provide the path for the repository you created on github :
git remote add origin " Git Repository Link"
- Push changes to github :
git push -u origin main
- Use any of this if the above code not works
git push origin master --force
git push --set-upstream origin main
✍️ Blog Link Step By Step: (👉Click Here)
- Copy the url link of the git repository
- Open Git Bash and run the following command
- Clone the repository :
git clone "RepositoryLink"
- Code - 1 :
git clone https://github.com/link.git
- Want to clone into Specific Path
- Code Format :
git clone "RepositoryLink" "Location Path"
- Example :
git clone https://github.com/link.git ./Test
- Note :
git init
to that folder - Clone to current folder:
git clone https://github.com/example/example.git ./
- Code Format :
- Code - 1 :
- Code - 2 :
cd "Git Repository Name"
- Code - 3 :
git remote -v
- (Folder Location) Code - 4 :
pwd
- pwd = print working directory
- Create a new file in that location(text.txt)
- Now check the status of your untracked files
- Code - 5 :
git status
- Code - 5 :
- Add your new file to the local project
- Code - 6 :
git add text.txt
- Code - 6 :
- Commit the changes to the local project
- Code - 7 :
git commit -m "Commit Name"
- Code - 7 :
- Finally, push the changes to the remote GitHub repository
- Code - 8 :
git push"
- Force Push:
git push -f"
- Code - 8 :
✍️ Blog Link Step By Step: (👉Click Here)
- Create a new file to in any local git repository
- Check the new file is tracked or untracked
- Code - 1 :
git status
- Code - 1 :
- If untracked , then allow to track or stage the file
- Code - 2 :
git add "file name"
- Code - 2 :
- Now GitHub is tracking the file
- Run git status to select which file you want to unstage
- Code - 1 :
git status
- Code - 1 :
- Code - 2 :
git reset -- "file name"
- Unstaging file successfully
✍️ Blog Link Step By Step: (👉Click Here)
- Indetifying the commit
- Code - 1 :
git log
- Code - 1 :
- Now copy the hash code of the commit want to revert
- Write the following code
- Code - 2 :
git checkout "Hash Code"
- Code - 2 :
🎥 Video Tutorial : (👉Click Here)
✍️ Blog Guide Step by Step : (👉Click Here)
🆚 Branching Using VsCode : (👉Click Here)
💻 Branching Using GitHub Desktop : (👉Click Here)
- Check Current Branches
- Code - 1 :
git branch
- Code - 1 :
- Create a new branch
- Code - 2 :
git branch New_Branch_Name
- Code - 2 :
- Switch to the new branch
- Code - 3 :
git checkout New_Branch_Name
- Code - 3 :
- If you want to switch to a main branch
- Code - 4 :
git checkout main
- Code - 4 :
- Rename the branch you created
- First Switch to the branch want to rename
- Code - 5 :
git branch -m new-name
- Delete a branch
- Local Branch :
git branch -d branch_name
- Another Way :
git push origin --delete branch_name
- Remote Branch :
git push origin --delete branch_name
- Local Branch :
- Check Branch Status
- Code - 6 :
git branch
- Code - 6 :
✍️ Blog Link Step By Step: (👉Click Here)
- Check Branch
- Code - 1 :
git branch
- Code - 1 :
- Choose the brance you want to update from main branch
- Code - 2 :
git checkout Branch_Name
- Code - 2 :
- Fetch Orgin or Maser Branch
- Code - 3 :
git fetch origin
- Code - 3 :
- Merge Orgin or Maser Branch into current branch
- Code - 4 :
git merge origin
- Code - 4 :
- Check Branch
- Code - 1 :
git branch
- Code - 1 :
- Choose the brance you want to update from main branch
- Code - 2 :
git checkout Branch_Name
- Code - 2 :
- Pull from master branch
- Code - 3 :
git pull origin master
- Code - 3 :
✍️ Blog Link Step By Step: (👉Click Here)
- Check Branch
- Code - 1 :
git branch
- Code - 1 :
- Choose the main brance
- Code - 2 :
git checkout main
- Code - 2 :
- Fetch Orgin or Maser Branch
- Code - 3 :
git fetch
- Code - 3 :
- Merge Orgin or Maser Branch
- Code - 4 :
git merge
- Code - 4 :
- Check Branch
- Code - 1 :
git branch
- Code - 1 :
- Choose the brance main branch
- Code - 2 :
git checkout Branch_Name
- Code - 2 :
- Pull from master branch
- Code - 3 :
git pull
- Force Pull :
git pull origin master
- Code - 3 :
🎥 Video Tutorial : (👉Click Here)
✍️ Blog Link Step By Step: (👉Click Here)
🎥 Video Tutorial : (👉Click Here)
- Create a any file in local repository
- Switch to another or new brance from main branch
- Code - 1 :
git checkout -b newbranch
- Code - 1 :
- Check Branch
- Code - 2 :
git branch
- Code - 2 :
- Check files commit status
- Code - 3 :
git status
- Code - 3 :
- Stage untracked files
- Code - 4 :
git add .
- Code - 4 :
- Commit the untracked files
- Code - 5 :
git commit -m "commit name"
- Code - 5 :
- Push to remote repository with new branch
- Code - 6 :
git push origin newbranch
- Code - 6 :
- Now do the following Steps 👉Click Here
1️⃣ What is github pages ? : (👉Click Here)
2️⃣ (Html - CSS - Javascript) Host a static website : (👉Click Here)
3️⃣ (Only readme.md) Host a static website : (👉Click Here)
4️⃣ (NPM Based) Host a react website : (👉Click Here)
🍀 Setup NPM & NodeJs (👉Click Here)
Basic Way | Advanced Way |
---|---|
git commit -m <message> |
git commit -m <title> -m <description> |
👉 Capitalize the first word and do not use in punctuation end
👉 Example :
❌❌ adding menu bar.
✅✅ Adding menu bar
👉 Use imperative mood in the subject line
👉 Example :
❌❌ dark mode toggle state
✅✅ Add fix for dark mode toggle state
👉 Use consistent set of words to describe your changes
👉 Example :
✅✅ Bugfix , Update , Refactor
👉 Be direct, try to eliminate filler words and phrases like (like : though, maybe, I think, kind of)
👉 Example :
❌❌ I added dark mode and maybe it has some issue
✅✅ Add fix for dark mode toggle state
👉 It creates a beautiful expression of the commit
👉 Example :
❌❌ Add fix for dark mode toggle state
✅✅ ➕ Add fix for dark mode toggle state
⚠️ NT : Since emojis use special ASCII codes (not commonly used and supported in the text-based interfaces like CLIs) and Unicode systems and most command-line interfaces need a third-party package or font to handle them, this convention might not look good to everyone. They might face some issues in terms of reading histories and checking the commit messages. (Like the emoji character in the message title might be rendered as its actual ASCII code or unknown question marks)
👉 Use a conventional Keyword first : Then explain the commit in detail
👉 Convetional Keywords like
- feat , fix , chore
- update , refactor , remove
- docs , style
- test , build , revert
👉 Example :
❌❌ fixed bug on landing page
✅✅ ➕ Fix: fix bug on landing page
👉 Format : git commit -m "feat: message"
✍️ When you add an existing new feature, use 'feat' commit type. It helps team members identify and track significant changes easily.
👉 Format : git commit -m "fix: message"
✍️ Addressing a bug ? Utlize 'fix' commit type to highlight that the commit resolves an issue or a problem in the repository code base
👉 Format : git commit -m "chore: message"
✍️ For non-feature/non-fix updates like updating dependencies or performing routine tasks, use 'chore' commit type
👉 Format : git commit -m "refactor: message"
✍️ When you improve the structure or readability of the code without adding features or fixing bugs, use 'refactor' commit type
👉 Format : git commit -m "docs: message"
✍️ Updating project documentation? Whether it's the README or other relevant files , 'docs' commit type keeps the documentation up to date
👉 Format : git commit -m "style: message"
✍️ For changes that don't affect code behavior but enhance code style or formatting , use 'style' commit type
👉 Format : git commit -m "test: message"
✍️ When you add or modify tests to ensure code quality and reliability , use 'test' commit type to keep track testing effort
👉 Format : git commit -m "perf: message"
✍️ Did you optimize the code to boost performance? Use 'perf' commit type
👉 Format : git commit -m "perf: message"
✍️ Changes related to continuous integration, such as configuring pipelines or adjusting build process, should use the 'ci' commit type
👉 Format : git commit -m "build: message"
✍️ For changes impacting the build system or external dependencies such as package updates or build script modification , use 'build' commit type
👉 Format : git commit -m "revert: message"
✍️ Mistakes happen! if you need to undo a previous commit , use 'revert commit type to roll back changes and restore the previous states
🕵️ Description: "Failed to connect to github.com port 443: Connection timed out" when pushing to remote repository
- 👉 Solution : Write the following command into GitBash
git config --global http.proxy
git config --global --unset https.proxy
- 👉 Solution : Blog Link Step By Step (👉Click Here)
🎥 Video Tutorial : (👉Click Here)
- Add all file from current repository
- Code - 1 :
git add .
- Code - 1 :
- Stage all files using commit command
- Code - 2 :
git commit -m "Commit Message Type"
- Code - 2 :
- To commit with your desire date use the following command with Time
- Code - 3 :
git commit --amend --date="2023-07-07 20:12:20"
- Code - 3 :
- Git Gui will take you to another page
- Now juust press Esc and type :wq then press Enter
- Now push the commit
- Code - 4 :
git push origin master
- Code - 4 :
- Successfully committed with a random date
✍️ Blog Link Step By Step: (👉Click Here)
There are various types of files we might want the git to ignore before committing, for example, the files that are to do with our user settings or any utility setting, private files like passwords and API keys. These files are not of any use to anyone else and we do not want to clutter our git. We can do this with the help of “.gitignore”
.gitignore is an auto-generated file inside the project folder that ignores/prevents files to get committed to the local and remote repositories.
- Create .gitignore File inside the project folder.
- Assume I have files name
- a.txt , b.txt , c.txt , text.txt
- Write the name of the files you want to ignore in the .gitignore text file. Each file name should be written in a new line .
- text.txt
- Initialize git in your terminal. Add these files to your git repository and commit all the changes with an appropriate message.
git init
git add .
git commit - m "Testing Git Ignore"
git push
- Using Git-Ignore will not commit the file name text.txt further and commit the rest of files
-
Blank Line: A blank line doesn’t refer to any file name, so we can use it to separate two file names for the ease of reading .
-
#: A line beginning with the # symbol refers to a comment .However if # is used as a pattern then use backslash (“\”) before the # symbol so that it is not misunderstood as a comment.
-
/: It is used as a directory separator i.e to include directories, for example webdev/ .
-
*.extension_name: For example _.txt and _.log can be used to match ALL the files that have .txt and .log as their extension respectively.
-
**/any_name: It is used to match any file or directory with the name any_name.
-
any_name/**: It is used to match anything that is inside the directory of the name - any_name. for example webdev/** matches all the files inside webdev directory.
# Compiled class file // Comment
*.class // Ignore Extension Type
# Log file
*.log
# Mobile Tools for Java (J2ME)
.mtj.tmp/ // Extension Directory Type
# Package Files
*.jar
🎥 Add Videos on README.md File: (👉Click Here)
🎶 Add Audio on README.md File: (👉Click Here)
📸 Add Images on README.md File: (👉Click Here)
💃 Add GIFs on README.md File: (👉Click Here)
🧠 Add images and links in Markdown by dragging and dropping in VSCode: (👉Click Here)
📻 Video Guide - Contributing to Open Source : (👉Click Here)
✍️ Step-by-step guide to contributing on GitHub : (👉Click Here)
✍️ Example Code Overview of Contributing to an existing repository : (👉Click Here)
🎥 Video Tutorial - How To Contribute in 3 Minutes : (👉Click Here)
🏠 Open Source BootCamp - Master Open Source Contributions : (👉Click Here)
🔍 How to Find the Best Repositories for Open Source Contribution : (👉Click Here)
🔍 How to Earn with Open Source Contributions : (👉Click Here)
📭 Open Source Crash Course - Beginner Guide to Open Source : (👉Click Here)
✍️ Open Source Crash Course Notes : (👉Click Here)
✍️ Top 10 Mistakes in Open Source Contribution World : (👉Click Here)
🎥 Fork a git repository : (👉Click Here)
➡️ Find the project's repository on GitHub
➡️ Then "fork" it by clicking the Fork button in the upper right corner
This creates a copy of the project repository in your GitHub account.
In the upper left corner, you will see that you are now looking at a repository in your account:
🎥 Clone a repository with GitHub Desktop : (👉Click Here)
➡️ While still in your repository, click the green Clone or download button
and then copy the HTTPS URL
Using Git on your local machine, clone your fork using the URL you just copied:
" git clone URL_OF_FORK "
Clone the repository you want to contribute from in your machine ( Copy the repository Link and Write the following code in Git Bash )
git clone https://github.com/Sumonta056/GitHub-Tutorial.git
Since the clone was downloaded into a subdirectory of your working directory, you can navigate to it using:
cd GitHub-Tutorial
You are going to be synchronizing your local repository with both the project repository (on GitHub) and your fork (also on GitHub). The URLs that point to these repositories are called "remotes". More specifically, the project repository is called the "upstream" remote, and your fork is called the "origin" remote.
When you cloned your fork, that should have automatically set your fork as the "origin" remote. Use git remote -v to show your current remotes
git remote -v
You should see the URL of your fork (which you copied in step 2) next to the word "origin".
If you don't see an "origin" remote, you can add it using: git remote add origin URL_OF_FORK.
git remote add origin https://github.com/Sumonta056/GitHub-Tutorial.git
Add the project repository as the "upstream" remote using: git remote add upstream URL_OF_PROJECT.
git remote add upstream https://github.com/scikit-learn/scikit-learn.git
Before you start making any changes to your local files, it's a good practice to first synchronize your local repository with the project repository. Use git pull upstream master to "pull" any changes from the "master" branch of the "upstream" into your local repository. (If the project repository uses "main" instead of "master" for its default branch, then you would use git pull upstream main instead.)
git pull upstream master
git pull upstream main
If you forked and cloned the project repository just a few minutes ago, it's very unlikely there will be any changes, in which case Git will report that your local repository is "already up to date". But if there are any changes, they will automatically be merged into your local repository.
Rather than making changes to the project's "master" branch, it's a good practice to instead create your own branch. This creates an environment for your work that is isolated from the master branch.
- Create a new branch to store any new changes
git branch branch-name
- Switch to that branch you created
git checkout branch-name
Use git branch to show your local branches. You should see your new branch as well as "master", and your new branch should have an asterisk next to it to indicate that it's "checked out" (meaning that you're working in it).
git branch
Use a text editor or IDE to make the changes you planned to the files in your local repository. Because you checked out a branch in the previous step, any edits you make will only affect that branch.
After you make a set of changes, use git add . to stage your changes and git commit -m "DESCRIPTION OF CHANGES" to commit them. Make changes. For example, I am creating a two file "file1.md" and "file2.md"
- Select the changed files
git add file1.md file2.md
- Take a snapshot of the staging area (anything that's been added)
git commit -m "my snapshot"
If you are making multiple sets of changes, it's a good practice to make a commit after each set.
When you are done making all of your changes, upload these changes to your fork using git push origin BRANCH_NAME. This "pushes" your changes to the "BRANCH_NAME" branch of the "origin" (which is your fork on GitHub).
Use any of the following code of pushing to repository
git push origin branch-name
git push --set-upstream origin my-branch
Return to your fork on GitHub, and refresh the page. You may see a highlighted area that displays your recently pushed branch:
Click the green Compare & pull request button to begin the pull request.
(Alternatively, if you don't see this highlighted area, you can switch to your branch using the Branch button and then click the New pull request button.)
✍️ How to create a pull request in GitHub : (👉Click Here)
🎥 Video Tutorial - How To Pull Request in 3 Minutes : (👉Click Here)
Congratulations on making your first open source contribution! 🎉
If you're ready to start making code contributions (beyond just fixing typos), here are a few tips:
- Browse through a repository's open issues (especially ones labeled "good first issue") to see if there is an issue you might be able to solve.
- If you're planning to contribute code that is unrelated to an existing issue, it's a good idea to open a new issue describing your proposal before starting work on it. The project maintainers might give you feedback that will help to shape your work, which will ultimately increase the likelihood that your pull request will be accepted.
- Read the project's contributing guide, which will usually be in the GitHub repository or the project documentation. It will likely contain many helpful tips for how to successfully contribute to the project.ing your first open source contribution!
📺 Video Tutorial : How to do Collaboration (👉Click Here)
🎥 How to give access permissions of your repository to other (👉Click Here)
❓ What is GitHub Issues? (👉Click Here)
📺 Video Tutorial : How To Create Issue in Repository (👉Click Here)
🎥 How To Create Issue Templete in Own Repository (👉Click Here)
- 🔍 GitHub Explore : 👉 Click Here
- 🎁 Up for Grabs : 👉 Click Here
- 🍁 HacktoberFest Projects : 👉 Click Here
- 🌟 Ovio Projects : 👉 Click Here
- 🚀 Good First Issues : 👉 Click Here
- 🌐 Google Summer of Code : 👉 Click Here
- 🌈 Outreachy : 👉 Click Here
- 🌌 MLH Fellowship : 👉 Click Here
- 🌍 Google For Developers : 👉 Click Here
- 🌞 GNOME Summer of Code : 👉 Click Here
🎥 Tutorial Resolving Merge Conflicts (With Example): (👉Click Here)
A merge conflict is an event that takes place when Git is unable to automatically resolve differences in code between two commits. Git can merge the changes automatically only if the commits are on different lines or branches.
The following is an example of how a Git merge conflict works:
Let’s assume there are two developers: Developer A and Developer B. Both of them pull the same code file from the remote repository and try to make various amendments in that file. After making the changes, Developer A pushes the file back to the remote repository from his local repository. Now, when Developer B tries to push that file after making the changes from his end, he is unable to do so, as the file has already been changed in the remote repository.
To prevent such conflicts, developers work in separate isolated branches. The Git merge command combines separate branches and resolves any conflicting edits.
✍️ Step by Step Blog to Resolve Merge Conflicts : (👉Click Here)
👉 Format : git log --merge
✍️ This command helps to produce the list of commits that are causing the conflict.
👉 Format : git diff
✍️ This command helps to identify the differences between the states repositories or file
👉 Format : git checkout
✍️ This command is used to undo the changes made to the file, or for changing branches..
👉 Format : git reset --mixed
✍️ This command is used to undo changes to the working directory and staging area
👉 Format : git reset --mixed
✍️ This command helps in exiting the merge process and returning back to the state before the merging began.
👉 Format : git reset
✍️ This command is used at the time of merge conflict to reset the conflicted files to their original state.
👉 Format : git status
✍️ This command displays the current state of the working directory and the repository.
✍️ It shows which files are modified, untracked, or staged for commit.
👉 Format : cd documentss
✍️ 'cd' is used to change the current working directory in the command line..
👉 Format : cat file.txt
✍️ 'cat' stands for "concatenate" and is used to display the contents of a file..
👉 Format : vi example.txt
✍️ 'vi' is a text editor available on Unix-like operating systems.
✍️ It allows you to create and edit files from the command line.
👉 Format : git rebase origin master
✍️ This command is used to reapply commits on top of another branch
(usually master) to incorporate changes and keep a linear commit history..
👉 Format : git rebase --abort
✍️ This command aborts an ongoing rebase operation,
reverting the repository back to its original state before the rebase.
👉 Format : git merge branch-name
✍️ This command merges changes from one branch into another.
👉 Format : git mergetool
✍️ This command launches a merge resolution tool
to help resolve conflicts during a merge or rebase.
👉 Format : git rebase --continue
✍️ This command continues a rebase operation after
resolving conflicts in the conflicted files.
🎥 Tutorial How To Edit Pushed Git Commit Message: (👉Click Here)
❤️🩹 Edit The ⭐ Last ⭐ Pushed Git Commit Message (👉Tutorial )
- ✍️ Open Git Terminal of Your Project
git commit --amend
-
✍️ New Window will open where in top you see the last commit message
-
✍️ Write the following commands
Press ESC
- ✍️ To Edit the Message
Press I
- ✍️ Now you can edit the Last Pushed Git Commit Message. After edit do this :
Press ESC
Press SHIFT + Z + Z
- ✍️ Now Push the Git Updated Commit Message
git push -f
- 🥳 Successfully Updated the Last Commit Message
🍂 Edit The ⭐ Any ⭐ Pushed Git Commit Message (👉Tutorial )
- ✍️ Open Git Terminal of Your Project
git rebase -i HEAD~5
[Here 5 = How Many last commit you want to see]
-
✍️ New Window will open where in top you see the all last commit message upto 5
-
✍️ Choose the desire commit Then
Press ESC
- ✍️ You will see "PICK" key word before your desire commit mesaage
Press I
- ✍️ Modify the "PICK" keyword to "Edit". After modifying do this :
Press ESC
Press SHIFT + Z + Z
- ✍️ Now write the following command
git commit --amend
- ✍️ To Edit The Last Selected Message
Press I
- ✍️ Now you can edit the selected Pushed Git Commit Message. After edit do this :
Press ESC
Press SHIFT + Z + Z
- ✍️ Now Push the Git Updated Commit Message
git push -f
- ✍️ Now write the following command
git push origin HEAD:main
git branch -M main
git rebase --continue
- ✍️ Now do a final push
git push -f
- 🥳 Successfully Updated the Selected Commit Message
✍️ Blog Guide Step by Step Git Reset: (👉Click Here )
🎥 Video Tutorial Git Revert vs Reset: (👉Click Here )
Git reset will undo changes up to the state of the specified commit ID. For example, reverting to the second commit ID will undo changes and leave the state of the file as the state of the second commit. Ggit revert will undo changes up to the state before the specified commit ID. For example, reverting to the second commit ID will undo changes and leave the state of the file as the state of the commit that comes before the second commit – the first commit.
The explanations above may seem confusing. The best way to understand it is to try it out yourself.
You should use git reset when working on a local repository with changes yet to be pushed remotely. This is because running this command after pulling changes from the remote repo will alter the commit history of the project, leading to merge conflicts for everyone working on the project.
Git reset is a good option when you realize that the changes being made to a particular local branch should be somewhere else. You can reset and move to the desired branch without losing your file changes.
Git revert is a good option for reverting changes pushed to a remote repository. Since this command creates a new commit, you can safely get rid of your mistakes without rearranging the commit history for everyone else.
🫁 How to Reset a Git Repository to a Specific Commit (👉Tutorial )
git log --oneline
We have selected the “Files added” commit, whose hash value is “9bd11a3”
git reset --hard 9bd11a3
git add .
git commit -m "Your Message"
git push origin main
😮💨 How to Revert a Git Repository to a Specific Commit (👉Tutorial )
git log --oneline
We have selected the “Files added” commit, whose hash value is “9bd11a3”
git revert 9bd11a3
Type "Esc"
Type "SHIFT + Z + Z"
Type ":wq"
🎥 How to Ignore Different File in Git Ignore : (👉 Video Link )
✍️ Prebuilt .gitIgnore Files for Different Language Projects: (👉Click Here )
git add README.md
Learn Markdown Langaue
✍️ Markdown Language Documenation Learning (Mine) : (👉Click Here )
🎥 Markdown Clean Sheet : (👉Click Here )
✍️ Learn Markdown Language with Practice Test : (👉Click Here )
✍️ Narkdown Guide Advance Level Everything : (👉Click Here )
Readme Design Tools Advance
✍️ Readme Table Basic Rules : (👉Click Here )
✍️ Github Readme Table Style : (👉Click Here )
✍️ Cools GIF For GitHub Readme : (👉Click Here )
GitHub Profile Readme Design Tools and Useful Website
🎥 Design Your GitHub Profile : (👉Click Here )
✍️ Awesome GitHub Profile README (GitHub + Website) : (👉Click Here )
✍️ Github Readme Activity Graph : (👉Click Here )
✍️ All GitHub Readme Stats (All in One): (👉Click Here )
🛺 GitHub Readme Profile Generator 1: (👉Click Here )
🛺 GitHub Readme Profile Generator 2: (👉Click Here )
🛺 GitHub Readme Profile Generator 3: (👉Click Here )
🛺 GitHub Readme Profile Generator 4: (👉Click Here )
✍️ Beautify GitHub Profile ( Everything - Badges - Widgets - Icons - Profile Generators) : (👉Click Here )
Automation Update Using GitHub Action and Workflows
✍️ Dev Metrics in Readme (Simple) : (👉Click Here )
✍️ Dev Metrics in Readme with added feature flags 🎌 : (👉Click Here )
✍️ Blog post workflow : (👉Click Here )
✍️ Stackoverflow - Push an existing Git repository : (👉Click Here )
-
Create a new repo at GitHub.
-
Navigate to your local Git repository in your terminal.
cd /path/to/your/repoin
- Rename the original remote to 'upstream'.
git remote rename origin upstream
- Add the new GitHub repo as 'origin'.
git remote add origin URL_TO_NEW_GITHUB_REPO
- Push the changes to the new 'origin' remote repository.
git push origin main