Skip to content

Tag: git

Git push asks username & password for HTTP repo origin

I am working on a project of mine and I got the codes uploaded in github. I started working in this project from Win10 os and currently I’m working in Arch linux. In windows it didn’t use to ask me for any password but it does now. I’ve never pushed from my linux before. Today when I tried t…

How to go back to the Working Directory that was not committed

I forgot to commit on the directory where I was working and then I checkout to the previous commit and now I want to back to the directory where I used to work. What can i do ? Answer If your checkout of the previous version somehow deleted your folder, which was not added/committed, then you would need to re…

Show mtime of a file in another branch

Using git ls-files –debug or stat command, you can see the mtime (last modified time) of a file in a current branch (strictly in a current commit). Then is there any way to see this information for the same file in another branch (another commit)? Workarounds Currently I have two workarounds, both of wh…

Can’t change git default branch to main on the command line

I’ve read on several sites that you can use git config –global init.defaultBranch main to change the default branch (from master) to main. But it doesn’t work for me. Here it’s from my terminal (my os is ubuntu): Answer The option init.defaultBranch was introduced in Git version 2.28. …

Can’t Fix Broken Git installation on Ubuntu

I was trying to install git on ubuntu, but there is an error when I try to install or fix broken git installation. This is the error: I tried other possibles solutions, I will list here: apt –fix-broken install. Error: The same problem as above. apt purge git. Show me to make an apt fix broken install s…

Using git diff to replicate changes in another directory

I have multiple websites structured (simplified) as follows under a single GIT repository: I did some amendments in /site-1/index.js, /site-1/package.json and added a file /site-1/changes.md. The changes were done in 2 separate git commit in a feature branch called feature/carousel. I want to apply the same c…