GIT Commands
How to push local branch to Remote Github :
$ git push origin [branch_name]
How do I make Git ignore file mode (chmod) changes:
git config --global core.fileMode false
How to check status of the current working branch:
git status
How to copy repository in to our local machine:
git clone <repository_url>
How to create new branch in our local:
git checkout -b <nameOfNewBranch>
How to check various branches on our local machine:
git branch
How to add fiule to git commit:
git add <filesName1> <filesName2>
How to add all modified files to git commit:
git add .
How to commit
git commit -m <message related to commit>
How to pull latest updates from teh branch
git pull origin <branch_name>
How to push local changes to github:
git push origin <branchName>
How to remove a local branch from our machine:
git branch -d {the_local_branch_name} (use -D instead to force deletion without checking merged status)
How to remove a remote branch from the server:
git push origin --delete {the_remote_branch}
How to push changes to specific branch:
git push origin <branch name>
How to get a list of changes made:
git log
How to get one line history :
git log --pretty=oneline
How to fetch latest changes in github repository:
git fetch
How to reset committed files:
git reset HEAD —<filename>
How to revert files back to original state:
git checkout -- <filename1> <filename2>
How to revert all modified files to original state:
git checkout .
How can we see all the branches from GitHub:
git branch -a
How to revert your branch to particular commit:
git push origin +[ref]:[branchName]
git push origin +4dcb94785b2cc45f2be5c58dbf333c47f9c2ea9c:feature/SCRM-8885_Aggregate_Invoices_with_AccountHistory
We can find "2cbeb6c68c238be6fdda41d4340560fafdf23539" from git hub URL of that commit
How to Squash Git Commits:
How can I ammend commits to previous commit and push that changes:
git commit - -amend
git push origin <branch_name> - -force
Git will occasionally repack your database automatically, always trying to save more space, but you can also manually repack at any time by running following command:
git gc
If you need to see what was done to the file in each commit:
git log -p path/to/file
To temporarily ignore changes in a certain file, run:
git update-index —-assume-unchanged <file>
Then when you want to track changes again:
git update-index --no-assume-unchanged <file>
How to find file permissions in Git:
git diff sugarcrm/vendor/symfony/validator/MetadataFactoryInterface.php
How to ignore file mode changes in Git :
git config core.fileMode false
Comments
Post a Comment