I defined my git config with git config --global diff.tool bc3
When I do git difftool --dir-diff, a becompare windows opens but I can't compare local file to remote.
On left panel, I see all remote files containing a difference with local files.
On right panel, I see theses file but only as shortcut to local file.
I can't compare a file to a shortcut. Is there a way to configure git or becompare to compare all files local to remote ?
git difftool --dir-diff will always create these symlinks when you compare something to your worktree.
There seems to be a specific setting for symlinks in Beyond Compare's menu :
https://www.scootersoftware.com/v4help/index.html?sessiondirhandling.html
under : Session > Session Settings > Handling
there should be a section : File Handling
with a checkbox : Follow symbolic links
Try checking that box.
Related
I have a inventory.txt in one folder of my azure repos. I need to copy that to another folder. I have used "Copy File task" but it copying file to the required folder only in agent machine.Its not reflecting in azure repos. What Can I do.
My Main Task is to give a packages_list variable in a inventory file. But this variable is being used by two yaml files which are two different folders and used for two different pipeline. For that I have declared a packages_list variable in one of the folder and copy to another folder. ANy other alternativeees are much appreciated.
After copy the files to target folder, you need run git command to push changes to sync the changed folder back into Azure devops repo.
Please try with below steps to configure your pipeline:
(1) The first Command line task:
git config --global user.email "xxx#xx.com"
git config --global user.name "Merlin"
cd $(Build.SourcesDirectory)
git init
(2) In second task, execute the Copy file task.
(3) In next Command line task, do git push to push the changes:
git add .
git commit -m "File copied"
git remote rm origin
git remote add origin https://xxx#dev.azure.com/xxx/xxx/_git/xxxx
git push -u origin HEAD:master
Since above command is modifying Azure repos, please enable Allow scripts to access the OAuth token in agent job and ensure the corresponding Build service account has Contribute permission to Git repos. Just follow this doc to configure the permission setting.
RESUME
When I push from my local workspace to the target repo in GitLab on my remote VPS, I want GitLab run a script and ask a beta repo on the same VPS to git checkout and pull in order to check my changes.
Current configurations
Gitlab configurations
Suppose you already have a project in your admin area, you just need to get it's relative path
Admin area > Projects
Select your project
Get the path in the project profil (hashed for this case)
Create a new directory in this location called custom_hooks.
sudo su
cd /var/opt/gitlab/git-data/repositories/hashed/path/of/project
mkdir custom_hooks
Inside the new custom_hooks directory, create a file with a name matching the hook type. For a post-receive hook the file name should be post-receive with no extension.
cd custom_hooks
nano post-receive
Write the code to make the server hook function as expected. Hooks can be in any language. Ensure the ‘shebang’ at the top properly reflects the language type. In that case the script code used is :
#!/bin/sh
unset GIT_INDEX_FILE
cd /var/repo/beta.git && git checkout master && git up # --[see the note 2 below]
Make the hook file executable and make sure it’s owned by Git.
chmod +x post-receive
Note 1 :
You can find more informations about git hooks here : GitLab Documentation : Server hooks
VPS configurations
Create new alias with #RichardHansen recommandations
git config --global alias.up '!git remote update -p; git merge --ff-only #{u}'
Note 2 :
During my researches, I've found an interesting answer about git pull on the forum.
I've decided to follow that advice and I made an alias named git up.
What is important is that :
it works with all (non-ancient) versions of Git,
it fetches all upstream branches (not just the branch you're currently working on), and;
it cleans out old origin/* branches that no longer exist upstream.
You can find more informations about "In what cases could git pull be harmful ?" here :
Link to answer
Create a directory for git repos only and access it to process Hooks configurations
# Create a repo for the project in apache area
mkdir /var/www/beta
# Create the git repo only folder
cd /var
mkdir repo && cd repo
# Create git repo and init
mkdir beta.git && cd beta.git
git init --bare # --bare means that our folder will have no source files, just the version control.
# Add gitlab remote
git remote add gitlab
# Accessing hooks folder to create script
cd hooks
cat > pre-receive
# On the blank line, write this script then 'ctrl + d' to save and press enter to exit
#!/bin/sh
unset GIT_INDEX_FILE
git --work-tree=/var/www/beta --git-dir=/var/repo/beta.git checkout -f
# Make the file executable
chmod +x post-receive
Note 3 :
'git-dir' is the path to the git repository. With 'work-tree', we can define a different path to where the files will actually be transferred to.
The 'post-receive' hook will be looked into every time a push is completed and will set the path where the files will be transferred to /var/www/beta in that case.
Local Workspace configurations
# Create in your workspace a folder to hold the project
cd /path/to/workspace
mkdir project && cd project
# Initialize git and add gitlab remote
git init
git remote add gitlab ssh://user#mydomain.com/gitlab/path/of/project
# Create an index.html file and send the initial commit
nano index.html
# copy this into the file then 'ctrl + x' then 'y' then 'enter' to save
<html>
<head>
<title>Welcome to Beta domain!</title>
</head>
<body>
<h1>Success! The beta virtual host is working!</h1>
</body>
</html>
# prepare the changes and then send the commit
git status
git add index.html
git commit -m "chore: add index.html :tada: :rocket:"
git push gitlab master
EXPECTED RESULTS
The expected result of this process is that when the git push gitlab master is done, the hook inside the gitlab hashed directory of the project, run a script who make something like this :
# Access the beta.git directory
cd /var/repo/beta.git
# Run command for updating repo
git checkout master && git up
# If we access the beta folder in apache area we should see index.html
cd /var/www/beta
ls
--index.html
ACTUAL RESULTS
No result.
ERROR MESSAGES
No error messages.
REQUEST
How can I set up a process like this one ?
There is something in my process I did not take in consideration ?
I'm trying to set up RStudio with gitlab. I have never used gitlab before, so i'm following set up instructions found online.
I created my gitlab account and project without any issues. I then followed the instructions found here for connecting RStudio with gitlab:
https://www.enricodata.com/post/setup-gitlab-with-rstudio/
The instructions say:
"In Rstudio go to Terminal and paste the following:
git config - - global user.email “YOUR EMAIL”
git config - - global user.name “YOUR NAME”
git config remote.origin.url git#gitlab.com:Allerious/code project.git"
When i execute the first two lines of code it outputs this in the console:
I'm unsure if this means it has done what it's supposed to have done.
Note: I did change “YOUR EMAIL” and “YOUR NAME” when running the code.
When i execute the third line of code it outputs this:
I'm thinking i should be changing the directory path to something else, but i'm unsure how to do this and what it should be changed to.
Here's another screen shot:
Maybe i should be changing the directory to one of these?
One day I change a vim configuration from Github(https://github.com/ma6174/vim) on Linux(Visualbox Ubuntu), then some git orders doesn't work.e.g.:
git diff
diff-so fancy | less --tabs = 4 RFX: 1: diff-so fancy | less -- tabs = 4 RFX: diff-so:not found 4: No such file or directory
RFX: No such file or directory
Also when I input git branch, git log, it's doesn't work.Just give me something wrong.
But I can use git add ,git commit -m "", git push to push my file to the remote repository.I also can create a new branch, while can't check the information about dev or master.
Please tell me how to let git work normally.
I have a this to aliases in my .gitconfig file:
setmeld = config --global diff.external git-meld
nomeld = config --global --unset diff.external
That way I can set and unset the visual diff tool meld.
When I issue:
git setmeld
...the following is added to my .gitconfig file:
[diff]
external = git-meld
When I issue:
git setmeld
...the external = git-meld setting is deleted from my .gitconfig file, but the [diff] section header stays.
If I later run git setmeld again my .gitconfig ends up having two [diff] section headers:
[diff]
[diff]
external = git-meld
If I unset and then set again the external git-meld diff tool I end up with this:
[diff]
[diff]
[diff]
external = git-meld
The problem is not because of the aliases. The same happens if I issue the commands by themselves git config --global diff.external git-meld and config --global --unset diff.external.
- Can I avoid that weird behavior?
OS: Ubuntu 12.04.5 LTS
git version: 1.7.9.5
git doesn't like empty sections.
Use the command
git config diff.dummy "dummy line"
You can edit the config to remove the extra [diff] lines, but be careful to save the config file to config.save first. If git finds that the config file is corrupted, it will refuse further commands.
Then set unset cycles will not add more duplicate sections
Your Git is very old (the current version is 2.8+) and you probably should update yours. The bug may be fixed in newer versions (I have not checked).
Meanwhile, though, this seems like a harmless bug: Git is leaving the section header in place even though the entire section is empty, then adding another section header even though there is already an existing section header. Given the way Git scans the file, though, you may repeat a section header (and a setting) as often as you like. For settings that are not cumulative,1 the last setting overrides the earlier ones.
As a rather hacky workaround, you can just set something else so that the section never becomes entirely empty. Any value will do: anything that Git never uses will just sit around unused, keeping the section not-empty.
There is in fact another diff setting you might want to set, though: diff.renameLimit sets the default size of the rename-detection queue for most git diff operations. In some versions, the "default default" is 500, 1000, and 2000 (it has been growing over time). As of the latest upcoming Git, the new default is 0, which means "unlimited" (which really means "use internal maximum"). I have kept mine set to 0 since very early days.
1One example of a cumulative setting is the value(s) for remote.origin.fetch, assuming you have a [remote "origin"] section. Each fetch = ... value in this section is accumulated, and when running git fetch origin, Git runs each reference obtained from that remote through all the mappings to find its local name. If the mapping produces multiple names, Git complains of an error. (Usually there is only one setting anyway, so that there is only one possible output.)