Skip to content
Advertisement

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 to push

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 rely

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 which I don’t think are beautiful solutions.

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. You must be running an older version which does not honor this

Filter output of git diff-tree based on file extension

gives me the list all the files that were committed for that SHA. I am looking for a way to get a list of files with only .xml or .html extensions. I checked the documentation page – here and couldn’t see any option. Any help is greatly appreciated. Answer You can use — <path> [<otherpath> …] for this : Be

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 sudo dpkg -i

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 changes in /site-2 and /site-3. I’ve tried the following: git format-patch master -o patches

Advertisement