Contents

Git Important Points

Website Visitors:
Contents
  • If there is no remote repository added like github or gitlab or bit bucket, when you run git log --oneline it shows only (HEAD -> master). But if you add a remote repository, it shows like (HEAD -> master, origin/master).
  • When you have modified different files on remote repo and local repo(one file on online repo and a different file on your local repo, not same file at both places), you have to first fetch and pull on local repo, and then push your locally modified file to online repo.
  • If you have same file modified on online repo and local repo, it throws an error as shown above. You have to remove changes locally and fetch, pull and then push.
  • Use code scanning tools like git secrets, secrets scanning, git hound (there are few more) to scan your git code and look for any secrets like username or auth keys, passwords etc are updated in the commits/code.
  • When you use git push origin master --force it will place your local repo on the remote repository. All the commits and code that was present in remote repo will be lost. So if multiple people are working on a repo, dont run force parameter on git push.

Your inbox needs more DevOps articles.

Subscribe to get our latest content by email.