
Mobile Application developer.
Conventions<NEW_BRANCH_NAME> = New branch name<BRANCH_NAME> = Current branch name<COMMIT_MESSAGE> = Message for commit/Description of changes/Message will be shown in Git.<SOURCE_BRANCH_NAME> = The branch which you want to merge<COMMIT_CODE> = Every commit will be assigned a unique commit code.
Branch Creationgit branch <NEW_BRANCH_NAME>git checkout <NEW_BRANCH_NAME>
ORgit checkout -b <NEW_BRANCH_NAME>
Switching to a branchgit checkout <BRANCH_NAME>
ORgit switch <BRANCH_NAME>
Pull Latest Codegit pull origin <NEW_BRANCH_NAME>
ORgit pull
Stash changes in the Branchgit stash
Use the below command to get the changes back to the branch.git stash pop
Upload Codegit add .git commit -m "<COMMIT_MESSAGE>"git push origin <BRANCH_NAME>
Merginggit merge <SOURCE_BRANCH_NAME>
Revert changesgit revert -m 1 <COMMIT_CODE>
Delete local branchgit branch -d <BRANCH_NAME>
Remove committed changes from PR or Branchgit reset --soft Head~1git reset HEAD .idea/git commit -m ".idea folder ignored" -> ".idea folder ignored" is commit messagegit push origin <BRANCH_NAME> -f
Remove the committed file from local changes
git reset HEAD path/to/unwanted_file
Remove the committed files from the commitgit rm --cached <file>git commit --amend# Examplesgit rm --cached "30-seconds.txt"git commit --amend# Removes 30-seconds.txt from the last commit
Rename the local branchgit branch -m <NEW_BRANCH_NAME>
To get all remote branches to the localgit fetch
Updating the git configurationsgit configuser.name<USER_NAME>git configuser.email<USER_EMAIL>
Update .gitignore file:
- Make changes in the .gitignore file.
- Run git rm -r --cached . command. /
- Run git add . command and git commit -m "Commit message" or just git commit or continue working. What is really important here is step 2. And remember to just run git add . the command before doing any commit.
Changing Your Repo's Language in GitHub: Please refer to the below link for more information on this topic.
https://dev.to/katkelly/changing-your-repo-s-language-in-github-5gjo
Git Worktree: Refer to the video below for more information.
https://www.youtube.com/watch?v=ntM7utSjeVUgit worktree add ../<FOLDER_NAME> <BRANCH_NAME>git worktree remove .
Stay tuned... I'll update this post with more commands later 👋



