Git tutorials

For developers, working in a team likes you eat and sleep daily. The question is how do they control different versions of project. In this tutorial, I want to summarize some basic commands of git bash for project version control in a remote programming.

GitHub for Beginners
How to be proficient in GitHub and Git Bash

How to undo modifications on a certain file

git branch:

git branch new_branch_name

Rename a local and remote branch

https://www.w3docs.com/snippets/git/how-to-rename-git-local-and-remote-branches.html

At the current branch, type: git branch -m new_branch_name

git branch -m old_branch_name new_branch_name

git push -u origin new_branch_name: to push the new branch to the remote repository

git checkout

git checkout branch_name

git checkout — file-name

git status

git status -s

git add

git add file1.txt file2.html

git add -A

git commit

git commit -m “add/modify the file xxx”

git pull

git pull –rebase

git push

Pushing is how you transfer commits from your local repository to a remote one. It’s the counterpart to git fetch, but whereas fetching imports commits to local branches, pushing exports commits to remote branches.

git commit

Changing a commit message

If a commit message makes non-sense and might contain unclear, incorrect or sensitive information, you can amend it locally and then push a new commit with a new message to your git repository.

Rewriting the most recent commit message

The most recent commit message can be amended by using the following command:

git commit –amend

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.